ydb-platform / ydb

YDB is an open source Distributed SQL Database that combines high availability and scalability with strong consistency and ACID transactions
https://ydb.tech
Apache License 2.0
3.82k stars 529 forks source link

Swap if with comparator to get rid of nothing #8564

Open zverevgeny opened 2 weeks ago

zverevgeny commented 2 weeks ago

Currently ssaProgram doesn't support nulls. And so predicate with Nothing can't be pushed down But in some cases it's possible to get rid of Nothing by rewriting a predicate

example predicate: (case when household_demographics.hd_vehicle_count > 0 then household_demographics.hd_dep_count/ household_demographics.hd_vehicle_count else null end) > 1.2

it can be rewritten to: if (household_demographics.hd_vehicle_count > 0, household_demographics.hd_dep_count/ household_demographics.hd_vehicle_count > 1.2, false)

pavelvelikhov commented 2 weeks ago

I don't see how you can rewrite this predicate to get rid of nulls