partiql / partiql-lang-kotlin

PartiQL libraries and tools in Kotlin.
https://partiql.org/
Apache License 2.0
536 stars 60 forks source link

NULL Predicate Behavior not conforming to SQL Spec #1475

Open yliuuuu opened 1 month ago

yliuuuu commented 1 month ago

Description

Expression R IS NULL R IS NOT NULL NOT R IS NULL NOT R IS NOT NULL
degree 1: null TRUE FALSE FALSE TRUE
degree 1: not null FALSE TRUE TRUE FALSE
degree > 1: all null TRUE FALSE FALSE TRUE
degree > 1: Some null FALSE FALSE TRUE TRUE
degree > 1: none null FALSE TRUE TRUE FALSE

In PartiQL: The NULL Predicate behavior is not conforming to this definition:

PartiQL> SELECT * FROM <<{'a': null}, {'a': null}>> IS NULL;
==='
<<
  {
    '_1': false
  }
>>
---

PartiQL> SELECT * FROM <<{'a': null}, {'a': 1}>> IS NULL;
==='
<<
  {
    '_1': false
  }
>>
---
OK!

The NULL Assertion behavior in PartiQL as of today only assert on if the collection itself is null, without examining the data in the collection.

To Reproduce

Steps to reproduce the behavior:

  1. XXX
  2. XXX

Expected Behavior

Additional Context