arthurhsu / lovefield-ts

Lovefield TypeScript port: successor of google/lovefield
Apache License 2.0
47 stars 3 forks source link

isNull() predicate not leveraging index #26

Open arthurhsu opened 1 year ago

arthurhsu commented 1 year ago

Consider the following query. db.select().from(employee).where(employee.hireDate.isNull());

Even if an index exists for the hireDate column, the index is not being used. The culprit seems to be at ValuePredicate#isKeyRangeCompatible, which explicitly checks for null. Maybe this is a left-over from when within SingleKeyRange null was a special value meaning "unbound". Need to verify if latest SingleKeyRange version can express the [null, null] range.