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

Cannot compare s-expressions and lists #1359

Open
dlurton opened this issue Feb 1, 2024 · 0 comments
Open

Cannot compare s-expressions and lists #1359

dlurton opened this issue Feb 1, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@dlurton
Copy link
Member

dlurton commented Feb 1, 2024

Description

PartiQL specification 12.2-7 states that the contents of ARRAY types (lists and s-expressions) should be compared lexicographically. I'm taking this to mean that a list and s-expresssion with the same contents should be equal--but PartiQL Kotlin doesn't implement this correctly.

  1. Arrays come next, and their values compare lexicographically based on the comparison of their elements, recur-
    sively. Notice that given an array [e1, . . . , em] and a longer array [e1, . . . , em, em+1, . . . , en] that has the same
    first m values, the former array comes first.

But PartiQL-Kotlin doesn't seem to have this implemented correctly.

To Reproduce

PartiQL> SEXP(1) = [1]
   | 
===' 
false
--- 
OK!
PartiQL> SEXP(1) > [1]
   | 

Evaluator Error: at line 1, column 9: Invalid comparision, <UNKNOWN> : <UNKNOWN>
Cannot compare values: `(1)`, [1]
PartiQL> SEXP(1) < [1]
   | 

Evaluator Error: at line 1, column 9: Invalid comparision, <UNKNOWN> : <UNKNOWN>
Cannot compare values: `(1)`, [1]

Expected Behavior

PartiQL> SEXP(1) = [1]
   | 
===' 
true
--- 
OK!
PartiQL> SEXP(1) > [1]
   | 
===' 
false
--- 
OK!
PartiQL> SEXP(1) < [1]
   | 
===' 
false
--- 
OK!

Additional Context

The rest of the operators (i.e. >=, <=, !=) should be checked to make sure they work too.

@dlurton dlurton added the bug Something isn't working label Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant