[jira] [Commented] (CALCITE-3230) Explicit CASTs by user are not applied.

2019-08-06 Thread Pressenna (JIRA)


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

Pressenna commented on CALCITE-3230:


[~danny0405], I apologise.

It turned out that Calcites definition of AVG did not match our internal 
definition of AVG.

Calcite expects AVG(input type) return a vale of input type.
Our internal implementation always returns a double for AVG.

Again, i apologise.
I close this ticket as invalid and will make sure to create reproducible tests 
before submitting more issues.

 

> Explicit CASTs by user are not applied.
> ---
>
> Key: CALCITE-3230
> URL: https://issues.apache.org/jira/browse/CALCITE-3230
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Reporter: Pressenna
>Priority: Major
>
> For some reason casting is not working correctly with aggregate functions.
> for example:
> {code:java}
> SELECT CAST(AVG(double_column) AS float) FROM foo GROUP BY group_coulmn;
> {code}
> does not apply the cast. We currently have to circumvent this by using 
> following dummy construct.
> {code:java}
> SELECT CAST( (AVG(double_column) + 0.0) AS float) FROM foo GROUP BY 
> group_coulmn;
> {code}
>  



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)


[jira] [Commented] (CALCITE-3230) Explicit CASTs by user are not applied.

2019-08-06 Thread Danny Chan (JIRA)


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

Danny Chan commented on CALCITE-3230:
-

Can you paste a test case here, i tried
{code:java}
 @Test public void testExplicitCastOfAggNotApplied() {
final HepProgram program = new HepProgramBuilder()
.addRuleInstance(ReduceExpressionsRule.PROJECT_INSTANCE)
.addRuleInstance(ReduceExpressionsRule.FILTER_INSTANCE)
.addRuleInstance(ReduceExpressionsRule.JOIN_INSTANCE)
.build();
final String sql = "select cast(avg(cast(sal as double)) as float)\n"
+ "from emp\n"
+ "group by ename";
checkPlanning(new HepPlanner(program), sql);
  }
{code}
in RelOptRules.java but does not reproduce this. The avg(double_column) return 
type is double, cast(double as float) should not be recognized as redundant.

> Explicit CASTs by user are not applied.
> ---
>
> Key: CALCITE-3230
> URL: https://issues.apache.org/jira/browse/CALCITE-3230
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Reporter: Pressenna
>Priority: Major
>
> For some reason casting is not working correctly with aggregate functions.
> for example:
> {code:java}
> SELECT CAST(AVG(double_column) AS float) FROM foo GROUP BY group_coulmn;
> {code}
> does not apply the cast. We currently have to circumvent this by using 
> following dummy construct.
> {code:java}
> SELECT CAST( (AVG(double_column) + 0.0) AS float) FROM foo GROUP BY 
> group_coulmn;
> {code}
>  



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)


[jira] [Commented] (CALCITE-3230) Explicit CASTs by user are not applied.

2019-08-06 Thread Pressenna (JIRA)


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

Pressenna commented on CALCITE-3230:


I am guessing it is caused by CALCITE-2590

> Explicit CASTs by user are not applied.
> ---
>
> Key: CALCITE-3230
> URL: https://issues.apache.org/jira/browse/CALCITE-3230
> Project: Calcite
>  Issue Type: Bug
>  Components: core
> Environment: For some reason casting is not working correctly with 
> aggregate functions.
> for example:
> {code:java}
> SELECT CAST(AVG(double_column) AS float) FROM foo GROUP BY group_coulmn;
> {code}
> does not apply the cast. We currently have to circumvent this by using 
> following dummy construct.
> {code:java}
> SELECT CAST( (AVG(double_column) + 0.0) AS float) FROM foo GROUP BY 
> group_coulmn;
> {code}
>  
>Reporter: Pressenna
>Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.14#76016)