drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From meh...@apache.org
Subject [2/2] drill git commit: DRILL-1945: Fix initialization variables for max aggregate function.
Date Tue, 20 Jan 2015 20:07:32 GMT
DRILL-1945: Fix initialization variables for max aggregate function.


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/7b05d080
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/7b05d080
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/7b05d080

Branch: refs/heads/master
Commit: 7b05d080c29022c3d04aba2b721f04f7a9a7f3fc
Parents: 2fc9d04
Author: Mehant Baid <mehantr@gmail.com>
Authored: Mon Jan 19 17:42:04 2015 -0800
Committer: Mehant Baid <mehantr@gmail.com>
Committed: Tue Jan 20 11:44:37 2015 -0800

----------------------------------------------------------------------
 .../src/main/codegen/templates/AggrTypeFunctions1.java    |  8 ++++----
 .../apache/drill/exec/fn/impl/TestAggregateFunctions.java | 10 ++++++++++
 2 files changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/7b05d080/exec/java-exec/src/main/codegen/templates/AggrTypeFunctions1.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/AggrTypeFunctions1.java b/exec/java-exec/src/main/codegen/templates/AggrTypeFunctions1.java
index e19def3..e4386b2 100644
--- a/exec/java-exec/src/main/codegen/templates/AggrTypeFunctions1.java
+++ b/exec/java-exec/src/main/codegen/templates/AggrTypeFunctions1.java
@@ -88,9 +88,9 @@ public static class ${type.inputType}${aggrtype.className} implements DrillAggFu
 	  <#elseif type.runningType?starts_with("BigInt")>
 	    value.value = Long.MIN_VALUE;
 	  <#elseif type.runningType?starts_with("Float4")>
-		value.value = Float.MIN_VALUE;
+		value.value = -Float.MAX_VALUE;
 	  <#elseif type.runningType?starts_with("Float8")>
-		value.value = Double.MIN_VALUE;	    
+		value.value = -Double.MAX_VALUE;
 	  </#if>
 	</#if>
 	  
@@ -163,9 +163,9 @@ public static class ${type.inputType}${aggrtype.className} implements
DrillAggFu
 	  <#elseif type.runningType?starts_with("BigInt")>
 	    value.value = Long.MIN_VALUE;
 	  <#elseif type.runningType?starts_with("Float4")>
-		value.value = Float.MIN_VALUE;
+		value.value = -Float.MAX_VALUE;
 	  <#elseif type.runningType?starts_with("Float8")>
-		value.value = Double.MIN_VALUE;	    
+		value.value = -Double.MAX_VALUE;
 	  </#if>
 	</#if>
 	  

http://git-wip-us.apache.org/repos/asf/drill/blob/7b05d080/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestAggregateFunctions.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestAggregateFunctions.java
b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestAggregateFunctions.java
index c5cc4f7..2b3ff50 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestAggregateFunctions.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestAggregateFunctions.java
@@ -46,4 +46,14 @@ public class TestAggregateFunctions extends BaseTestQuery {
         .baselineValues(2l)
         .build().run();
   }
+
+  @Test
+  public void testMaxWithZeroInput() throws Exception {
+    testBuilder()
+        .sqlQuery("select max(employee_id * 0.0) as max_val from cp.`employee.json`")
+        .unOrdered()
+        .baselineColumns("max_val")
+        .baselineValues(0.0d)
+        .go();
+  }
 }


Mime
View raw message