Skip to content

Add support for row value expression predicands #515

@michael-simons

Description

@michael-simons

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions