Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

External collections, via Calcite #5

Closed
julianhyde opened this issue Nov 27, 2019 · 1 comment
Closed

External collections, via Calcite #5

julianhyde opened this issue Nov 27, 2019 · 1 comment

Comments

@julianhyde
Copy link
Collaborator

Currently lists are always ML lists, but this feature would allow lists via a "table" API.

For example, a list could be based on the Emps table in a JDBC data source. Evaluating that list in ML would entail preparing a JDBC query.

We will use Apache Calcite's Table API to represent an external collection, and RelBuilder to build relational expressions.

A schema (in the JDBC sense of the word) would be an ML record. For example, hr would be a value with emps and depts fields, and you could write

from e in (#emps hr), d in (#depts hr) where #deptno e = #deptno d

We would need some API to create the hr value.

@julianhyde
Copy link
Collaborator Author

Fixed in 2acb5ca. When you start the shell, there are now collections called scott and foodmart backed by JDBC databases. And you can add your own collection based on anything in Calcite. For example:

= scott;
val it = {bonus=<relation>,dept=<relation>,emp=<relation>,salgrade=<relation>} :
{bonus:{comm:real, ename:string, job:string, sal:real} list,
dept:{deptno:int, dname:string, loc:string} list,
emp:{comm:real, deptno:int, empno:int, ename:string, hiredate:string, job:string, mgr:int, sal:real} list,
salgrade:{grade:int, hisal:real, losal:real} list}
= from e in #emp scott where #deptno e = 10 yield #ename e;
val it = ["CLARK","KING","MILLER"] : string list

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant