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

Allow comma-separated scans in join, and on in the from clause #216

Closed
julianhyde opened this issue Jan 20, 2024 · 0 comments
Closed

Allow comma-separated scans in join, and on in the from clause #216

julianhyde opened this issue Jan 20, 2024 · 0 comments

Comments

@julianhyde
Copy link
Collaborator

Currently you can have comma-separated scans immediately following from, like this:

from e in emps, d in depts

but not following join. The following query is now legal:

from e in emps
  where e.job = 'CLERK'
join d in depts,
  l in locations

It's especially useful for declaring unbound variables:

from a, b
  where a < b
join c, d, e, f
  where a > 0
    andalso b > 0
    andalso c > 0
    andalso d > 0
    andalso e > 0
    andalso f > 0
    andalso a + b + c + d + e + f < 10

Also, you now can use on in from:

from e in emps, d in depts on e.deptno = d.deptno

Previously on was only allowed in join. on in the first scan after from was, and remains, illegal:

from e in emps on e.sal > 10,  (*) illegal 'on'
  d in depts
julianhyde added a commit to julianhyde/morel that referenced this issue Jan 20, 2024
…rom` clause

The following is now legal:
  from a in [1, 2],
      b in [3, 4, 5] on a + b = 6
  where b < 5
  join c in [6, 7] on b + c = 10,
      d in [7, 8]

An `on` after the first scan, `from a in [1, 2]`, was and
remains illegal.

Remove Op.INNER_JOIN, because its semantics is identical to Op.SCAN.
(We will add operators back if and when we support `left join`.)

Fixes hydromatic#216
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