You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (JIRA)" <ji...@apache.org> on 2016/08/30 16:18:21 UTC

[jira] [Comment Edited] (CALCITE-1366) Metadata provider for predicates pulls up expressions without references incorrectly

    [ https://issues.apache.org/jira/browse/CALCITE-1366?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15449424#comment-15449424 ] 

Julian Hyde edited comment on CALCITE-1366 at 8/30/16 4:17 PM:
---------------------------------------------------------------

Can you justify why zero columns should be a special case? You can think of {{COUNT\(*)}} is just the 0-column variant of {{COUNT\(x)}} (1 column), {{COUNT\(x, y)}} (2 columns), etc.

Maybe we shouldn't be pulling up aggregates? In which case there would also be a problem with {{SELECT x, SUM\(x) ... GROUP BY x}}.


was (Author: julianhyde):
Can you justify why zero columns should be a special case? You can think of {{COUNT(*)}} is just the 0-column variant of {{COUNT(x)}} (1 column), {{COUNT(x, y)}} (2 columns), etc.

Maybe we shouldn't be pulling up aggregates? In which case there would also be a problem with {{SELECT x, SUM(x) ... GROUP BY x}}.

> Metadata provider for predicates pulls up expressions without references incorrectly
> ------------------------------------------------------------------------------------
>
>                 Key: CALCITE-1366
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1366
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.9.0
>            Reporter: Jesus Camacho Rodriguez
>            Assignee: Jesus Camacho Rodriguez
>
> In org.apache.calcite.rel.metadata.RelMdPredicates.java:
> {code}
> ...
>     for (RexNode r : inputInfo.pulledUpPredicates) {
>       ImmutableBitSet rCols = RelOptUtil.InputFinder.bits(r);
>       if (groupKeys.contains(rCols)) {
>         r = r.accept(new RexPermuteInputsShuttle(m, input));
>         aggPullUpPredicates.add(r);
>       }
>     }
> ...
> {code}
> The check does not take into account that _rCols_ might be empty, and then _r_ cannot be pulled up e.g. count\(*).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)