support mixed types for row filtering
cldellow opened this issue · 0 comments
SQLite inherited Tcl's loose typing. "1930"
can be summed like it was a number and 1930
can be compared successfully to its string form.
The SQLite vtable API permits an implementation to filter non-responsive rows before returning them to the SQLite VM for processing. We currently do this, but only if the type of the column in the row group matches the type in the constraint, eg:
sqlite-parquet-vtable/parquet/parquet_cursor.cc
Lines 339 to 342 in bc0be71
This results in a performance penalty if the user mixes and matches types, which would be a very natural thing for a SQLite user to do:
sqlite> select count(*) from census where profile_id = '1930';
5469
Run Time: real 0.636 user 0.640000 sys 0.000000
sqlite> select count(*) from census where profile_id = 1930;
5469
Run Time: real 2.235 user 2.220000 sys 0.012000
We should accommodate this use case - perhaps by doing the conversion at query construction time in the xFilter
API.