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

<in predicate> incorrectly interpreting RHS values #130

Open
johnedquinn opened this issue Dec 7, 2024 · 0 comments
Open

<in predicate> incorrectly interpreting RHS values #130

johnedquinn opened this issue Dec 7, 2024 · 0 comments

Comments

@johnedquinn
Copy link
Member

See the SQL:1999 EBNF for the <in predicate>.

Looking at 2 tests (for both modes), inPredicateWithTableConstructor and notInPredicateWithTableConstructor, their queries are each, respectively:

  1. SELECT VALUE b.title FROM stores[*].books[*] AS b WHERE (b.title, b.price) IN (VALUES ('A', 5e0), ('B', 3.0), ('X', 9.0))
  2. SELECT VALUE b.title FROM stores[*].books[*] AS b WHERE (b.title, b.price) NOT IN (VALUES ('A', 5e0), ('B', 3.0), ('X', 9.0))

According to the EBNF, the IN predicate expects a parenthesis followed by row value expressions. Therefore, upon fixing the parse in partiql/partiql-lang-kotlin#1666, the two tests above fail. The reason is that the table value constructor (the VALUES expression) constructs a SINGLE expression. Therefore, the query is effectively asking: is (b.title, b.price) IN the collection holding a single value (the table value constructor), which holds multiple rows?

Therefore, I believe these conformance tests are wrong. In order to accurately ask the question, we would need to rephrase the 1st query to be EITHER:

  1. (b.title, b.price) IN VALUES ('A', 5e0), ('B', 3.0), ('X', 9.0) (removing the parenthesis)
  2. OR, (b.title, b.price) IN (('A', 5e0), ('B', 3.0), ('X', 9.0))
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