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

Add support for row value expression predicands #515

Open
6 of 16 tasks
michael-simons opened this issue Jan 17, 2024 · 2 comments
Open
6 of 16 tasks

Add support for row value expression predicands #515

michael-simons opened this issue Jan 17, 2024 · 2 comments

Comments

@michael-simons
Copy link
Collaborator

From sql2cypher created by lukaseder: neo4j-contrib/sql2cypher#31

The SQL standard and various dialects support row value expressions both as predicands in predicates, as well as expressions in projections. The latter could be interesting too, in a second step, but for now, I'd like to add support for the former, namely:

  • QOM.RowIsNull and QOM.RowIsNotNull (they're not inverses!):
    • (a, b) IS NULL is just a IS NULL AND b IS NULL
    • (a, b) IS NOT NULL is just a IS NOT NULL AND b IS NOT NULL
  • QOM.RowCondition:
    • (a, b) = (c, d) is just a = c AND b = d
    • (a, b) > (c, d) is a > c OR a = c AND b > d
  • QOM.RowOverlaps:
    • (a, b) OVERLAPS (c, d): To be defined. jOOQ has a convenience OVERLAPS, SQL only supports temporal/interval overlapping
  • QOM.RowIsDistinctFrom
    • (a, b) IS DISTINCT FROM (b, c): To be investigated if Cypher has a DISTINCT predicate
  • QOM.RowInCondition:
    • (a, b) IN ((c, d), (e, f)) is just (a, b) = (c, d) OR (a, b) = (e, f) (and then recurse)
  • QOM.RowBetweenCondition
    • (a, b) BETWEEN [ SYMMETRIC ] (c, d) AND (e, f) is just (a, b) >= (c, d) AND (a, b) <= (e, f) (and then recurse)
  • QOM.RowSubqueryCondition
    • (a, b) IN (SELECT c, d FROM t) is emulated using EXISTS (SELECT 1 FROM t WHERE (a, b) = (c, d))

This should act as dogfooding catalyst for adding support to those objects int he jOOQ QOM API:

@michael-simons
Copy link
Collaborator Author

This has been fun so far. Improvements to jOOQ/jOOQ#13640 require a new jOOQ snapshot version. Also, I've discovered a flaw in jOOQ: jOOQ/jOOQ#14555

@michael-simons
Copy link
Collaborator Author

Wow, I'm learning a lot about SQL :)

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