Hi devs,

When trying to optimize the below query with calcite 1.29.0, it's not
properly reducing the PLUS operation on date literal and interval literal.
I'm using CoreRules.PROJECT_REDUCE_EXPRESSIONS

select TIMESTAMPADD(DAY, 22, TIMESTAMP '1995-12-10 02:06:17') as
constant_col  from nation

LogicalProject(constant_col=[+(1995-12-10 02:06:17, *(86400000:INTERVAL
DAY, 22))])
  BindableTableScan(table=[[table-test-db, nation]], projects=[[]],
aliases=[[constant_col]])

However, the same query is getting optimized to, calcite 1.23.0.

LogicalProject(constant_col=[1996-01-01 02:06:17])
  BindableTableScan(table=[[table-test-db, nation]], projects=[[]],
aliases=[[constant_col]])

What could be the possible causes for this difference in the latest calcite
version?

Regards,
Chathura

Reply via email to