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

ASF GitHub Bot commented on DRILL-7931:
---------------------------------------

paul-rogers commented on a change in pull request #2259:
URL: https://github.com/apache/drill/pull/2259#discussion_r654629939



##########
File path: 
exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestAggregateFunctions.java
##########
@@ -1239,4 +1239,17 @@ public void testInjectVariablesHashAgg() throws 
Exception {
       client.resetSession(PlannerSettings.STREAMAGG.getOptionName());
     }
   }
+
+  @Test //DRILL-7931
+  public void testRowTypeMissMatch() throws Exception {
+    testBuilder()
+      .sqlQuery("select col1, stddev(col2) as g1, SUM(col2) as g2 FROM " +
+        "(values ('UA', 3), ('USA', 2), ('UA', 3), ('USA', 5), ('USA', 1), " +
+        "('UA', 9)) t(col1, col2) GROUP BY col1 order by col1")
+      .ordered()
+      .baselineColumns("col1", "g1", "g2")
+      .baselineValues("UA", 3.4641016151377544, 15L)
+      .baselineValues("USA", 2.0816659994661326, 8L)

Review comment:
       Thanks for providing a test! The floating point value is likely 
unstable: it might differ in the last few digits on different systems. I 
suggest using a function to round the value to, say, four or five (or whatever) 
decimals to avoid floating point "noise."




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Rowtype mismatch in DrillReduceAggregatesRule
> ---------------------------------------------
>
>                 Key: DRILL-7931
>                 URL: https://issues.apache.org/jira/browse/DRILL-7931
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Query Planning & Optimization
>    Affects Versions: 1.18.0
>            Reporter: wtf
>            Assignee: wtf
>            Priority: Major
>
> It's work correct for example in case when there is only one aggregation:
> select col1, stddev(col2) FROM(values ('UA', 3), ('USA', 2), ('UA', 3), 
> ('USA', 5), ('USA', 1), ('UA', 9)) x(col1, col2) GROUP BY col1 LIMIT 6;
> Or when it's after other aggregations:
> select col1, SUM(col2), stddev(col2) FROM (values ('UA', 3), ('USA', 2), 
> ('UA', 3), ('USA', 5), ('USA', 1), ('UA', 9)) x(col1, col2) GROUP BY col1 
> LIMIT 6;
> But when we try to put it before an aggregation, like SUM:
> select col1, stddev(col2), SUM(col2) FROM (values ('UA', 3), ('USA', 2), 
> ('UA', 3), ('USA', 5), ('USA', 1), ('UA', 9)) x(col1, col2) GROUP BY col1 
> LIMIT 6;
> It's failed with error:
> SYSTEM ERROR: AssertionError: Type mismatch:
> rowtype of new rel:
> RecordType(CHAR(3) NOT NULL col1, BIGINT $f1, BIGINT $f2, BIGINT NOT NULL 
> $f3, BIGINT $f4) NOT NULL
> rowtype of set:
> RecordType(CHAR(3) NOT NULL col1, BIGINT $f1, BIGINT $f2, BIGINT NOT NULL 
> $f3, BIGINT NOT NULL $f4) NOT NULL
> Same for stddev_samp



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

Reply via email to