You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Anil Gupta Somisetty (Jira)" <ji...@apache.org> on 2025/05/08 08:09:00 UTC

[jira] [Updated] (CALCITE-7003) Query rewrite with materialization doesn't work for below query

     [ https://issues.apache.org/jira/browse/CALCITE-7003?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Anil Gupta Somisetty updated CALCITE-7003:
------------------------------------------
    Description: 
Table A:
a string,
b string,
c string,
d integer
 
Materialization:
select a, b, c, sum(d) from tabA group by a, b, c
Query: 
select upper(a), b, c, sum(d) from tabA where c = 'abc' group by upper(a), b, c
 
My above query rewrite with materialization doesn't happen and I figured out it is because of the optimization at [https://github.com/apache/calcite/blob/19ce56761e0b377f2b3e1d7286bcde969ed8e8db/core/src/main/java/org/apache/calcite/rel/rules/materialize/MaterializedViewRule.java#L482] made in commit [https://github.com/apache/calcite/commit/aa25dcbe565196fb6b78149042ee817427ed4f68]

by [~jcamacho] 
 

  was:
Table A:
a string,
b string,
c string,
d integer
 
Materialization:
select a, b, c, sum(d) from tabA group by a, b, c
Query: 
select upper(a), b, c, sum(d) from tabA where c = 'abc' group by upper(a), b, c
 
My above query rewrite with materialization doesn't happen and I figured out it is because of the optimization at [https://github.com/apache/calcite/blob/19ce56761e0b377f2b3e1d7286bcde969ed8e8db/core/src/main/java/org/apache/calcite/rel/rules/materialize/MaterializedViewRule.java#L482] made in commit [https://github.com/apache/calcite/commit/aa25dcbe565196fb6b78149042ee817427ed4f68]
 


> Query rewrite with materialization doesn't work for below query
> ---------------------------------------------------------------
>
>                 Key: CALCITE-7003
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7003
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Anil Gupta Somisetty
>            Priority: Major
>
> Table A:
> a string,
> b string,
> c string,
> d integer
>  
> Materialization:
> select a, b, c, sum(d) from tabA group by a, b, c
> Query: 
> select upper(a), b, c, sum(d) from tabA where c = 'abc' group by upper(a), b, c
>  
> My above query rewrite with materialization doesn't happen and I figured out it is because of the optimization at [https://github.com/apache/calcite/blob/19ce56761e0b377f2b3e1d7286bcde969ed8e8db/core/src/main/java/org/apache/calcite/rel/rules/materialize/MaterializedViewRule.java#L482] made in commit [https://github.com/apache/calcite/commit/aa25dcbe565196fb6b78149042ee817427ed4f68]
> by [~jcamacho] 
>  



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