trino icon indicating copy to clipboard operation
trino copied to clipboard

Improve comparison predicate pushdown when varchar column cast to date

Open findepi opened this issue 3 years ago • 0 comments

Such a cast cannot reasonably be pruned away because the source varchar value can be any of multiple forms (surrounding whitespace, optional year sign, optional leading zeros for date components). However, a usefully narrow Domain can be extracted and passed over to connectors to help connectors prune the data.

Fixes https://github.com/trinodb/trino/issues/12925

findepi avatar Aug 09 '22 13:08 findepi

Marked draft because

  • pending clarification on whether any kind of predicate pushdown is allowed, see https://github.com/trinodb/trino/pull/13605#discussion_r942552662
  • the current implementation isn't correct yet

findepi avatar Aug 10 '22 14:08 findepi

Ready for review now.

findepi avatar Aug 24 '22 11:08 findepi

Added a test in TestIcebergMetadataFileOperations that shows gains for Iceberg. Gains for JDBC connectors are "obvious".

findepi avatar Aug 24 '22 11:08 findepi

Gains for JDBC connectors are "obvious".

Out of curiosity: how would we be able to test the gains?

findinpath avatar Aug 25 '22 12:08 findinpath

Gains for JDBC connectors are "obvious".

Out of curiosity: how would we be able to test the gains?

We could perhaps check number of input positions (rows) retrieved from the remote database.

findepi avatar Aug 25 '22 12:08 findepi