ibis
ibis copied to clipboard
fix: include casts for numeric Literals except in comparisons
Fixes https://github.com/ibis-project/ibis/issues/10890
I only ran this for duckdb locally, I'm curious to see how this does on all the other backends.
This is a bit of a one-off approach to special-case for the predicate pushdown problem described in project/ibis/issues/9662. eg we only make the special case of ops.UntypedNumericLiteral for numbers, but are there other instances where we also want to avoid a cast, so this should be a more general ops.UntypedLiteral?
- Need to verify that the solution keeps the predicate pushdown described in https://github.com/ibis-project/ibis/issues/9662
- The other backends tests for test_numeric_literal need to get updated, because now
ibis.dtype_from_backend_string(ibis.literal(12.34, <type>).typeof()) == <type>is always true (yay!)
For myself, a few of the common tests to run
- pytest -k numeric_literal -vv ibis/backends/tests/test_numeric.py
- pytest --snapshot-update -vv ibis/backends/tests/sql/test_compiler.py
- pytest --snapshot-update -vv ibis/backends/tests/sql/test_sql.py
- pytest duckdb ibis/backends/duckdb/tests/test_geospatial.py
Seems like this needs some TLC.
Im going to wait on working on this until more of my easier PRs get merged
Marking as draft to make review triage a bit easier!