Skip to content

[multistage][bug] multiple literal function chain didn't get evaluated as RexLiteral #12245

@walterddr

Description

@walterddr

chaining 2 functions with literal resolution didn't happen in v2 engine:

SELECT * FROM tbl WHERE val > ToEpochDays(fromDateTime('1970-01-15', 'yyyy-MM-dd'))
Execution Plan
LogicalAggregate(group=[{}], agg#0=[COUNT($0)])
  PinotLogicalExchange(distribution=[hash])
    LogicalAggregate(group=[{}], agg#0=[COUNT()])
      LogicalFilter(condition=[<($9, ToEpochDays(1209600000:BIGINT))]) <-- problem

it apparently only evaluates single layer of rex literal

  • for example here 1970-01-15 00:00:00
SELECT * FROM tbl WHERE CAST(val AS TIMESTAMP) > fromDateTime('1970-01-15', 'yyyy-MM-dd')
Execution Plan
LogicalAggregate(group=[{}], agg#0=[COUNT($0)])
  PinotLogicalExchange(distribution=[hash])
    LogicalAggregate(group=[{}], agg#0=[COUNT()])
      LogicalFilter(condition=[<(CAST($9):TIMESTAMP(0) NOT NULL, 1970-01-15 00:00:00)])
  • and here: 14:BIGINT
SELECT * FROM tbl WHERE val > ToEpochDays(1209600000)
Execution Plan
LogicalAggregate(group=[{}], agg#0=[COUNT($0)])
  PinotLogicalExchange(distribution=[hash])
    LogicalAggregate(group=[{}], agg#0=[COUNT()])
      LogicalFilter(condition=[<($9, 14:BIGINT)])

CC @xiangfu0 who has more context from #11438

Metadata

Metadata

Assignees

Labels

bugmulti-stageRelated to the multi-stage query engine

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions