[jira] [Updated] (CALCITE-4251) Overload RelMetadataQuery#getColumnOrigin method

2020-10-09 Thread xzh_dz (Jira)


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

xzh_dz updated CALCITE-4251:

Description: 
A case:
{code:java}
final String sql1 = ""
+ "select empno, sum(sal) as all_sal\n"
+ "from emp\n"
+ "group by empno";
{code}
When i try to get the `all_sal` origin column field,it will return null and it 
is derived. we always get the origin column although it is derived. We should 
overload this method and determine whether the column is derived by setting 
parameters.

 org.apache.calcite.rel.metadata.RelMetadataQuery#getColumnOrigin
{code:java}
// code placeholder
public RelColumnOrigin getColumnOrigin(RelNode rel, int column) {
  final Set origins = getColumnOrigins(rel, column);
  if (origins == null || origins.size() != 1) {
return null;
  }
  final RelColumnOrigin origin = Iterables.getOnlyElement(origins);
  return origin.isDerived() ? null : origin;
}
{code}
 

 

 

 

  was:
A case:
{code:java}
final String sql1 = ""
+ "select empno, sum(sal) as all_sal\n"
+ "from emp\n"
+ "group by empno";
{code}
When i try to get the `all_sal` origin column field,it will return null and it 
is derived. we always get the origin column although it is derived. We should 
overload this method and determine whether the column is derived by setting 
parameters.

 

 

 


> Overload RelMetadataQuery#getColumnOrigin method
> 
>
> Key: CALCITE-4251
> URL: https://issues.apache.org/jira/browse/CALCITE-4251
> Project: Calcite
>  Issue Type: Wish
>Reporter: xzh_dz
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> A case:
> {code:java}
> final String sql1 = ""
> + "select empno, sum(sal) as all_sal\n"
> + "from emp\n"
> + "group by empno";
> {code}
> When i try to get the `all_sal` origin column field,it will return null and 
> it is derived. we always get the origin column although it is derived. We 
> should overload this method and determine whether the column is derived by 
> setting parameters.
>  org.apache.calcite.rel.metadata.RelMetadataQuery#getColumnOrigin
> {code:java}
> // code placeholder
> public RelColumnOrigin getColumnOrigin(RelNode rel, int column) {
>   final Set origins = getColumnOrigins(rel, column);
>   if (origins == null || origins.size() != 1) {
> return null;
>   }
>   final RelColumnOrigin origin = Iterables.getOnlyElement(origins);
>   return origin.isDerived() ? null : origin;
> }
> {code}
>  
>  
>  
>  



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


[jira] [Updated] (CALCITE-4251) Overload RelMetadataQuery#getColumnOrigin method

2020-10-05 Thread xzh_dz (Jira)


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

xzh_dz updated CALCITE-4251:

Description: 
A case:
{code:java}
final String sql1 = ""
+ "select empno, sum(sal) as all_sal\n"
+ "from emp\n"
+ "group by empno";
{code}
When i try to get the `all_sal` origin column field,it will return null and it 
is derived. we always get the origin column although it is derived. We should 
overload this method and determine whether the column is derived by setting 
parameters.

 

 

 

  was:
A case:

 
{code:java}
final String sql1 = ""
+ "select empno, sum(sal) as all_sal\n"
+ "from emp\n"
+ "group by empno";
{code}
When i try to get the `all_sal` origin column field,it will return null and it 
is derived. we always get the origin column although it is derived. We should 
overload this method.

 

 

 


> Overload RelMetadataQuery#getColumnOrigin method
> 
>
> Key: CALCITE-4251
> URL: https://issues.apache.org/jira/browse/CALCITE-4251
> Project: Calcite
>  Issue Type: Wish
>Reporter: xzh_dz
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> A case:
> {code:java}
> final String sql1 = ""
> + "select empno, sum(sal) as all_sal\n"
> + "from emp\n"
> + "group by empno";
> {code}
> When i try to get the `all_sal` origin column field,it will return null and 
> it is derived. we always get the origin column although it is derived. We 
> should overload this method and determine whether the column is derived by 
> setting parameters.
>  
>  
>  



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


[jira] [Updated] (CALCITE-4251) Overload RelMetadataQuery#getColumnOrigin method

2020-10-03 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot updated CALCITE-4251:

Labels: pull-request-available  (was: )

> Overload RelMetadataQuery#getColumnOrigin method
> 
>
> Key: CALCITE-4251
> URL: https://issues.apache.org/jira/browse/CALCITE-4251
> Project: Calcite
>  Issue Type: Wish
>Reporter: xzh_dz
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> A case:
>  
> {code:java}
> final String sql1 = ""
> + "select empno, sum(sal) as all_sal\n"
> + "from emp\n"
> + "group by empno";
> {code}
> When i try to get the `all_sal` origin column field,it will return null and 
> it is derived. we always get the origin column although it is derived. We 
> should overload this method.
>  
>  
>  



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


[jira] [Updated] (CALCITE-4251) Overload RelMetadataQuery#getColumnOrigin method

2020-10-03 Thread xzh_dz (Jira)


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

xzh_dz updated CALCITE-4251:

Description: 
A case:

 
{code:java}
final String sql1 = ""
+ "select empno, sum(sal) as all_sal\n"
+ "from emp\n"
+ "group by empno";
{code}
When i try to get the `all_sal` origin column field,it will return null and it 
is derived. we always get the origin column although it is derived. We should 
overload this method.

 

 

 

  was:
A case:

 
{code:java}
// 
select col1, col2 , sum(count_col4) as sum_col4 
from (
  select col1, col2, col3, count(col4) as count_col4   
  from tbl   
  group by col1, col2, col3
)
group by col1, col2
{code}
When i try to get the `sum_col4` origin column field,it will return null and it 
is derived. we always get the origin column although it is derived. We should 
overload this method.

 

 

 


> Overload RelMetadataQuery#getColumnOrigin method
> 
>
> Key: CALCITE-4251
> URL: https://issues.apache.org/jira/browse/CALCITE-4251
> Project: Calcite
>  Issue Type: Wish
>Reporter: xzh_dz
>Priority: Major
>
> A case:
>  
> {code:java}
> final String sql1 = ""
> + "select empno, sum(sal) as all_sal\n"
> + "from emp\n"
> + "group by empno";
> {code}
> When i try to get the `all_sal` origin column field,it will return null and 
> it is derived. we always get the origin column although it is derived. We 
> should overload this method.
>  
>  
>  



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