diff options
author | Mehant Baid <mehantr@gmail.com> | 2015-01-19 17:42:04 -0800 |
---|---|---|
committer | Mehant Baid <mehantr@gmail.com> | 2015-01-20 11:44:37 -0800 |
commit | 7b05d080c29022c3d04aba2b721f04f7a9a7f3fc (patch) | |
tree | 4811175c3294698dfbbd206add74a98581f1da8b /exec/java-exec | |
parent | 2fc9d0471f05da9c40277fa6d372f27c726bdf92 (diff) |
DRILL-1945: Fix initialization variables for max aggregate function.
Diffstat (limited to 'exec/java-exec')
-rw-r--r-- | exec/java-exec/src/main/codegen/templates/AggrTypeFunctions1.java | 8 | ||||
-rw-r--r-- | exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestAggregateFunctions.java | 10 |
2 files changed, 14 insertions, 4 deletions
diff --git a/exec/java-exec/src/main/codegen/templates/AggrTypeFunctions1.java b/exec/java-exec/src/main/codegen/templates/AggrTypeFunctions1.java index e19def360..e4386b221 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> 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 c5cc4f7b2..2b3ff50ef 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(); + } } |