Skip to content

Add rule for unwrapping TIMESTAMP to DATE cast when comparing with DATE literal#11170

Merged
losipiuk merged 1 commit intotrinodb:masterfrom
losipiuk:lo/unwrap-timestatmp-to-date
Feb 28, 2022
Merged

Add rule for unwrapping TIMESTAMP to DATE cast when comparing with DATE literal#11170
losipiuk merged 1 commit intotrinodb:masterfrom
losipiuk:lo/unwrap-timestatmp-to-date

Conversation

@losipiuk
Copy link
Copy Markdown
Member

@losipiuk losipiuk commented Feb 23, 2022

Description

Add a rule for unwrapping TIMESTAMP to DATE cast when comparing with DATE literal

Is this change a fix, improvement, new feature, refactoring, or other?

improvement

Is this a change to the core query engine, a connector, client library, or the SPI interfaces? (be specific)

core query engine (optimizer)

How would you describe this change to a non-technical end user or system administrator?

New rule rewrites CAST(ts_column as DATE) OP date_literal to range expression on ts_column. Dropping cast
allows for further optimizations, such as pushdown into connectors.

Documentation

(x) No documentation is needed.
( ) Sufficient documentation is included in this PR.
( ) Documentation PR is available with #prnumber.
( ) Documentation issue #issuenumber is filed, and can be handled later.

Release notes

( ) No release notes entries required.
(x) Release notes entries required with the following suggested text:

# General
* Improve performance of specific queries which compare table columns of type `timestamp` with `date` literals. ({issue}`11170`)

@cla-bot cla-bot bot added the cla-signed label Feb 23, 2022
@losipiuk losipiuk requested review from findepi and martint February 23, 2022 19:26
@findepi
Copy link
Copy Markdown
Member

findepi commented Feb 25, 2022

cc @kasiafi

@findepi
Copy link
Copy Markdown
Member

findepi commented Feb 25, 2022

General

Improve performance of specific queries which compare table columns of type timestamp with date literals. ({issue}11170)

this matters especially when timestamp value is a column, and connector supports predicate pushdown.
cc @hashhar @wendigo

@losipiuk losipiuk merged commit 60f81a9 into trinodb:master Feb 28, 2022
@github-actions github-actions bot added this to the 372 milestone Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants