CoreRules not getting applied.

2022-02-15 Thread Chathura Widanage
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 Logi

Re: Invalid IntervalSQLType

2022-02-10 Thread Chathura Widanage
nternally in milliseconds. The latter are > represented in months. > > This is one area where Postgres does things differently from the SQL > standard. > > > > On Feb 10, 2022, at 3:48 AM, Chathura Widanage < > chathurawidan...@gmail.com> wrote: > > >

Re: Invalid IntervalSQLType

2022-02-10 Thread Chathura Widanage
> > Best, > Stamatis > > [1] > > https://github.com/apache/calcite/blob/812e3e98eae518cf85cd1b6b7f055fb96784a423/core/src/main/java/org/apache/calcite/rex/RexLiteral.java#L357 > > > On Thu, Feb 10, 2022 at 8:02 AM Chathura Widanage < > chathurawidan...@gmail.

Invalid IntervalSQLType

2022-02-09 Thread Chathura Widanage
Hi community, I'm comparing two rel expressions generated by calcite 1.25.0 and 1.29.0 and noticed there is an invalid IntervalSQLType plugged into the query. <=($6, 1998-09-02 00:00:00) : Calcite 1.25.0 vs <=($6, CAST(-(1998-12-01, 777600:INTERVAL DAY)):TIMESTAMP(0) NOT NULL) : Calcite 1.29.

Excluding internal operators

2022-02-02 Thread Chathura Widanage
Hi, I want to exclude SEARCH operator introduced in calcite 1.26.0 from my optimized Rel Expression. I'm calling org.apache.calcite.tools.Frameworks.ConfigBuilder#operatorTable with a customized set of operators which doesn't include SEARCH. But when a HepPlanner is used to optimize the RelNode tr

Re: Getting child Expressions on latest version of Calcite.

2022-02-02 Thread Chathura Widanage
give you the top-level > expression or expressions, it goes deep. > > If you know you are looking at a particular kind of operator (e.g. > Project, Filter, Join, Sort), call the particular method that returns the > expressions (Project.getProjects(), Filter.getCondition(), etc.).

Getting child Expressions on latest version of Calcite.

2022-02-02 Thread Chathura Widanage
Hi, I'm upgrading a set of custom rules from 1.23.0 to the latest. We have a custom rule that uses org.apache.calcite.rel.RelNode#getChildExps and seems it's deprecated in latest versions. Although it suggests to use org.apache.calcite.rel.RelNode#accept(org.apache.calcite.rex.RexShuttle), I could

Re: Behavior of SINGLE_VALUE aggregate

2021-12-21 Thread Chathura Widanage
rwise, this is not a scalar). > > Regards, > Vladimir. > > вт, 21 дек. 2021 г. в 13:52, Chathura Widanage : > > > Hi, > > > > Could you please explain the behaviour of SINGLE_VALUE aggregate with the > > equivalent SQL query? > > > >

Behavior of SINGLE_VALUE aggregate

2021-12-21 Thread Chathura Widanage
Hi, Could you please explain the behaviour of SINGLE_VALUE aggregate with the equivalent SQL query? SqlSingleValueAggFunction (Apache Calcite calcite API) It's not clear whether the "value" in