Skip to content

Cannot compare s-expressions and lists  #1359

Open
@dlurton

Description

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.

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions