Skip to content

[CALCITE-3244] RelDecorrelator unable to decorrelate expression with …#1417

Closed
danny0405 wants to merge 3 commits intoapache:masterfrom
danny0405:CALCITE-3244
Closed

[CALCITE-3244] RelDecorrelator unable to decorrelate expression with …#1417
danny0405 wants to merge 3 commits intoapache:masterfrom
danny0405:CALCITE-3244

Conversation

@danny0405
Copy link
Contributor

…filter and aggregate on top

final LogicalAggregate aggregate = (LogicalAggregate) e.rel;
if (aggregate.getGroupSet().isEmpty()
&& aggregate.getAggCallList().stream()
.anyMatch(c -> c.getAggregation() instanceof SqlCountAggFunction)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't need to be count, any agg function with empty groupset will always generate 1 row.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but only count agg doesn't output nulls.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to trust the aggregate function to derive its own nullability.

For example, SUM knows that even when applied to a not-null column x, if the groupSet is empty it may return null. COUNT knows that it never returns null.

So maybe just look at the rowType of Aggregate, and look at whether the columns are NOT NULL.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Julian, let me have a try :)

@danny0405
Copy link
Contributor Author

Close this PR because i have no idea how to fix it probably now.

@danny0405 danny0405 closed this Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants