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

Julian Hyde commented on CALCITE-4348:
--------------------------------------

{quote}It seems like that can not preserves line breaks
{quote}
That is not true. Maybe you need to be in 'Text' mode (rather than 'Visual') 
when you paste. Here is a case that has an error stack: CALCITE-3929.

> Materialization recognition fails when query has calculation expression
> -----------------------------------------------------------------------
>
>                 Key: CALCITE-4348
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4348
>             Project: Calcite
>          Issue Type: Wish
>            Reporter: xzh_dz
>            Priority: Major
>         Attachments: image-2020-10-21-11-40-08-353.png
>
>
> The following example should be recognized by materialized views, but failed.
> {code:java}
> // code placeholder
> org.apache.calcite.test.MaterializedViewSubstitutionVisitorTest
> @Test void testAggregateComplexExpression() {
>   String mv = ""
>       + "select \"deptno\", \"salary\", count(\"commission\")\n"
>       + "from \"emps\"\n"
>       + "group by \"deptno\", \"salary\"";
>   String query = ""
>       + "select \"deptno\" + \"salary\", count(\"commission\")\n"
>       + "from \"emps\"\n"
>       + "group by \"deptno\" + \"salary\"";
>   sql(mv, query).ok();
> }
> {code}
> {code:java}
> Query:
> Aggregate(groupSet: {0}, groupSets: [{0}], calls: [COUNT($1)])
>     Calc(program: (expr#0..4=[{inputs}], expr#5=[+($t1, $t3)], $f0=[$t5], 
> commission=[$t4]))
>       Scan(table: [hr, emps])
> mv:
> Aggregate(groupSet: {0, 1}, groupSets: [{0, 1}], calls: [COUNT($2)])
>   Calc(program: (expr#0..4=[{inputs}], deptno=[$t1], salary=[$t3], 
> commission=[$t4]))
>     Scan(table: [hr, emps]){code}
> Exception:
> !image-2020-10-21-11-40-08-353.png|width=606,height=223!
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to