You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Mihai Budiu (Jira)" <ji...@apache.org> on 2026/09/17 18:25:00 UTC

[jira] [Commented] (CALCITE-7793) RelMdDistinctRowCount passes an Aggregate predicate to the Aggregate's input without translating column references

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

Mihai Budiu commented on CALCITE-7793:
--------------------------------------

This quidem test crashes due to this bug:
{code:java}
with t(n, r) as (
  values (1, cast(row(10) as row(d integer))),
         (2, cast(row(20) as row(d integer)))
)
select e.n
from t e
where e.n > (
  select avg(e2.n)
  from t e2
  where (e2.r).d = (e.r).d
  and exists (
     select 1
     from (values (1, cast(row(10) as row(d integer)))) as b(k, br)
     where b.k = e2.n
     and (b.br).d = (e.r).d
  )
); {code}
stack trace:
{code:java}
java.lang.AssertionError: fieldList must not be null, type = INTEGER
	at org.apache.calcite.rel.type.RelDataTypeImpl.getFieldList(RelDataTypeImpl.java:201)
	at org.apache.calcite.rex.RexFieldAccess.checkValid(RexFieldAccess.java:85)
	at org.apache.calcite.rex.RexFieldAccess.<init>(RexFieldAccess.java:73)
	at org.apache.calcite.rex.RexShuttle.visitFieldAccess(RexShuttle.java:215)
	at org.apache.calcite.rex.RexCall.accept(RexCall.java:208)
	at ...RelMdDistinctRowCount.getDistinctRowCount(RelMdDistinctRowCount.java:111)
	at ...RelMdDistinctRowCount.getDistinctRowCount(RelMdDistinctRowCount.java:321)
	at ...RelMdDistinctRowCount.getDistinctRowCount(RelMdDistinctRowCount.java:199) {code}

> RelMdDistinctRowCount passes an Aggregate predicate to the Aggregate's input without translating column references
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-7793
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7793
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.42.0
>            Reporter: Mihai Budiu
>            Priority: Major
>
> This is an exact counterpart to CALCITE-7687
> I marked it as "major" since it can potentially lead to incorrect results



--
This message was sent by Atlassian Jira
(v8.20.10#820010)