[jira] [Commented] (CALCITE-3928) Canonicalization doesn't do field trimming before materialized view matching

2020-04-21 Thread Jin Xing (Jira)


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

Jin Xing commented on CALCITE-3928:
---

[~xzh_dz] 
Thanks for PR ~ comments left.

> Canonicalization doesn't do field trimming before materialized view matching
> 
>
> Key: CALCITE-3928
> URL: https://issues.apache.org/jira/browse/CALCITE-3928
> Project: Calcite
>  Issue Type: Bug
>Reporter: Jin Xing
>Priority: Major
>  Labels: materializedviews
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> If we have query and materialized view as below:
> {code:java}
> query:
> LogicalAggregate(group=[{4}], agg#0=[COUNT($3)])
>   LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], SAL=[$5], DEPTNO=[$7])
> LogicalTableScan(table=[[scott, EMP]])
> mv logic:
> LogicalAggregate(group=[{1}], agg#0=[COUNT($0)])
>   LogicalProject(SAL=[$5], DEPTNO=[$7])
> LogicalTableScan(table=[[scott, EMP]])
> {code}
> The semantics of query and mv logic are the same. Materialized view matching 
> failed, because field trimming is not done when canonicalizing the plans.
> Currently Calcite does field trimming  when convert sql to rel. But my 
> company's internal system does materialization detection – – generates & 
> transforms & stores the RelNode.
> Shall we add the field trimming when canonicalizing materialized view logic?
>  



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


[jira] [Commented] (CALCITE-3928) Canonicalization doesn't do field trimming before materialized view matching

2020-04-21 Thread Jin Xing (Jira)


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

Jin Xing commented on CALCITE-3928:
---

The case I mentioned is not accurate, [~xzh_dz] I updated your case into Jira 
description.

> Canonicalization doesn't do field trimming before materialized view matching
> 
>
> Key: CALCITE-3928
> URL: https://issues.apache.org/jira/browse/CALCITE-3928
> Project: Calcite
>  Issue Type: Bug
>Reporter: Jin Xing
>Priority: Major
>  Labels: materializedviews
>
> If we have query and materialized view as below:
> {code:java}
> query:
> LogicalAggregate(group=[{0}], EXPR$1=[afunc($1, $1)])
>   LogicalProject(a=$0, b=[bfunc($1)])
> LogicalTableScan(table=[[default, user_table]])
> mv:
> LogicalAggregate(group=[{0}], EXPR$1=[afunc($1, $2)])
>   LogicalProject(a=$0, b=[bfunc($1)], c=[bfunc($1)])
> LogicalTableScan(table=[[default, user_table]])
> {code}
> The semantics of query and mv logic are the same. Materialized view matching 
> failed, because field trimming is not done when canonicalizing the plans.
> Currently Calcite does field trimming  when convert sql to rel. But my 
> company's internal system does materialization detection – – generates & 
> transforms & stores the RelNode.
> Shall we add the field trimming when canonicalizing materialized view logic?
>  



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


[jira] [Commented] (CALCITE-3928) Canonicalization doesn't do field trimming before materialized view matching

2020-04-21 Thread xzh_dz (Jira)


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

xzh_dz commented on CALCITE-3928:
-

Follow [~jinxing6...@126.com] illustrated, A case as below:

{code:java}
query:
LogicalAggregate(group=[{4}], agg#0=[COUNT($3)])
  LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], SAL=[$5], DEPTNO=[$7])
LogicalTableScan(table=[[scott, EMP]])

mv logic:
LogicalAggregate(group=[{1}], agg#0=[COUNT($0)])
  LogicalProject(SAL=[$5], DEPTNO=[$7])
LogicalTableScan(table=[[scott, EMP]])

{code}
query has the same semantics with mv logic. Materialization reconginze will be 
failed because the mv logic unable to express query.
So we should try to add the field trimming for canonicalizing.

> Canonicalization doesn't do field trimming before materialized view matching
> 
>
> Key: CALCITE-3928
> URL: https://issues.apache.org/jira/browse/CALCITE-3928
> Project: Calcite
>  Issue Type: Bug
>Reporter: Jin Xing
>Priority: Major
>  Labels: materializedviews
>
> If we have query and materialized view as below:
> {code:java}
> query:
> LogicalAggregate(group=[{0}], EXPR$1=[afunc($1, $1)])
>   LogicalProject(a=$0, b=[bfunc($1)])
> LogicalTableScan(table=[[default, user_table]])
> mv:
> LogicalAggregate(group=[{0}], EXPR$1=[afunc($1, $2)])
>   LogicalProject(a=$0, b=[bfunc($1)], c=[bfunc($1)])
> LogicalTableScan(table=[[default, user_table]])
> {code}
> The semantics of query and mv logic are the same. Materialized view matching 
> failed, because field trimming is not done when canonicalizing the plans.
> Currently Calcite does field trimming  when convert sql to rel. But my 
> company's internal system does materialization detection – – generates & 
> transforms & stores the RelNode.
> Shall we add the field trimming when canonicalizing materialized view logic?
>  



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


[jira] [Commented] (CALCITE-3928) Canonicalization doesn't do field trimming before materialized view matching

2020-04-19 Thread Vineet Garg (Jira)


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

Vineet Garg commented on CALCITE-3928:
--

[~jinxing6...@126.com] Can you provide the actual query or test case? We might 
be missing a case for rewriting but I am not sure if I understand this fully.

> Canonicalization doesn't do field trimming before materialized view matching
> 
>
> Key: CALCITE-3928
> URL: https://issues.apache.org/jira/browse/CALCITE-3928
> Project: Calcite
>  Issue Type: Bug
>Reporter: Jin Xing
>Priority: Major
>
> If we have query and materialized view as below:
> {code:java}
> query:
> LogicalAggregate(group=[{0}], EXPR$1=[afunc($1, $1)])
>   LogicalProject(a=$0, b=[bfunc($1)])
> LogicalTableScan(table=[[default, user_table]])
> mv:
> LogicalAggregate(group=[{0}], EXPR$1=[afunc($1, $2)])
>   LogicalProject(a=$0, b=[bfunc($1)], c=[bfunc($1)])
> LogicalTableScan(table=[[default, user_table]])
> {code}
> The semantics of query and mv logic are the same. Materialized view matching 
> failed, because field trimming is not done when canonicalizing the plans.
> Currently Calcite does field trimming  when convert sql to rel. But my 
> company's internal system does materialization detection – – generates & 
> transforms & stores the RelNode.
> Shall we add the field trimming when canonicalizing materialized view logic?
>  



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


[jira] [Commented] (CALCITE-3928) Canonicalization doesn't do field trimming before materialized view matching

2020-04-17 Thread Danny Chen (Jira)


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

Danny Chen commented on CALCITE-3928:
-

[~xzh_dz], you may need to ask a JIRA issue permission to the DEV mailing list, 
with your JIRA ID.

> Canonicalization doesn't do field trimming before materialized view matching
> 
>
> Key: CALCITE-3928
> URL: https://issues.apache.org/jira/browse/CALCITE-3928
> Project: Calcite
>  Issue Type: Bug
>Reporter: Jin Xing
>Priority: Major
>
> If we have query and materialized view as below:
> {code:java}
> query:
> LogicalAggregate(group=[{0}], EXPR$1=[afunc($1, $1)])
>   LogicalProject(a=$0, b=[bfunc($1)])
> LogicalTableScan(table=[[default, user_table]])
> mv:
> LogicalAggregate(group=[{0}], EXPR$1=[afunc($1, $2)])
>   LogicalProject(a=$0, b=[bfunc($1)], c=[bfunc($1)])
> LogicalTableScan(table=[[default, user_table]])
> {code}
> The semantics of query and mv logic are the same. Materialized view matching 
> failed, because field trimming is not done when canonicalizing the plans.
> Currently Calcite does field trimming  when convert sql to rel. But my 
> company's internal system does materialization detection – – generates & 
> transforms & stores the RelNode.
> Shall we add the field trimming when canonicalizing materialized view logic?
>  



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


[jira] [Commented] (CALCITE-3928) Canonicalization doesn't do field trimming before materialized view matching

2020-04-16 Thread xzh_dz (Jira)


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

xzh_dz commented on CALCITE-3928:
-

Hi Jin~
I want to work on it ~
Can you assign this one to me ?

> Canonicalization doesn't do field trimming before materialized view matching
> 
>
> Key: CALCITE-3928
> URL: https://issues.apache.org/jira/browse/CALCITE-3928
> Project: Calcite
>  Issue Type: Bug
>Reporter: Jin Xing
>Priority: Major
>
> If we have query and materialized view as below:
> {code:java}
> query:
> LogicalAggregate(group=[{0}], EXPR$1=[afunc($1, $1)])
>   LogicalProject(a=$0, b=[bfunc($1)])
> LogicalTableScan(table=[[default, user_table]])
> mv:
> LogicalAggregate(group=[{0}], EXPR$1=[afunc($1, $2)])
>   LogicalProject(a=$0, b=[bfunc($1)], c=[bfunc($1)])
> LogicalTableScan(table=[[default, user_table]])
> {code}
> The semantics of query and mv logic are the same. Materialized view matching 
> failed, because field trimming is not done when canonicalizing the plans.
> Currently Calcite does field trimming  when convert sql to rel. But my 
> company's internal system does materialization detection – – generates & 
> transforms & stores the RelNode.
> Shall we add the field trimming when canonicalizing materialized view logic?
>  



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


[jira] [Commented] (CALCITE-3928) Canonicalization doesn't do field trimming before materialized view matching

2020-04-15 Thread Danny Chen (Jira)


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

Danny Chen commented on CALCITE-3928:
-

The title is really hard to understand, maybe we can try to describe in the SQL 
way, use the SQL keywords.

> Canonicalization doesn't do field trimming before materialized view matching
> 
>
> Key: CALCITE-3928
> URL: https://issues.apache.org/jira/browse/CALCITE-3928
> Project: Calcite
>  Issue Type: Bug
>Reporter: Jin Xing
>Priority: Major
>
> If we have query and materialized view as below:
> {code:java}
> query:
> LogicalAggregate(group=[{0}], EXPR$1=[afunc($1, $1)])
>   LogicalProject(a=$0, b=[bfunc($1)])
> LogicalTableScan(table=[[default, user_table]])
> mv:
> LogicalAggregate(group=[{0}], EXPR$1=[afunc($1, $2)])
>   LogicalProject(a=$0, b=[bfunc($1)], c=[bfunc($1)])
> LogicalTableScan(table=[[default, user_table]])
> {code}
> The semantics of query and mv logic are the same. Materialized view matching 
> failed, because field trimming is not done when canonicalizing the plans.
> Currently Calcite does field trimming  when convert sql to rel. But my 
> company's internal system does materialization detection – – generates & 
> transforms & stores the RelNode.
> Shall we add the field trimming when canonicalizing materialized view logic?
>  



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