apache / apache/beam

Analytic functions can't be planned with filter.

Open
#20,893 0 comments 0 reactions 0 assignees View on GitHub
bug dsl P3 sql
Dominant language
Java
Stars
8.7k
Forks
4.7k
Avg merge
1d 20h
Merged PRs (30d)
196

Description

Example query: "SELECT item, purchases, category, sum(purchases) over (PARTITION BY category ORDER BY purchases ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) as total_purchases  FROM PCOLLECTION WHERE purchases \> 3"
 
Caused by: org.apache.beam.vendor.calcite.v1_20_0.org.apache.calcite.plan.RelOptPlanner$CannotPlanException: *There are not enough rules to produce a node with desired properties:* convention=BEAM_LOGICAL. All the inputs have relevant nodes, however the cost is still infinite.
Root: rel#11:Subset#2.BEAM_LOGICAL
Original rel:
LogicalProject(subset=[rel#11:Subset#2.BEAM_LOGICAL], item=[$0], purchases=[$2], category=[$1], total_purchases=[SUM($2) OVER (PARTITION BY $1 ORDER BY $2 ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)]): rowcount = 50.0, cumulative cost = \{inf}, id = 9
  LogicalFilter(subset=[rel#8:Subset#1.NONE], condition=[\>($2, 3)]): rowcount = 50.0, cumulative cost = \{inf}, id = 7
    BeamIOSourceRel(subset=[rel#6:Subset#0.BEAM_LOGICAL], table=[[beam, PCOLLECTION]]): rowcount = 100.0, cumulative cost = \{100.0 cpu, 0.0 cpuRate }, id = 3

Imported from Jira [BEAM-12331](https://issues.apache.org/jira/browse/BEAM-12331). Original Jira may contain additional context.
Reported by: ibzib.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.