drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amansi...@apache.org
Subject [1/2] drill git commit: DRILL-4119: Modify hash32 functions to combine the msb and lsb bytes of a 64-bit hash value (previously, we were casting to integer).
Date Tue, 01 Dec 2015 00:28:26 GMT
Repository: drill
Updated Branches:
  refs/heads/master 5cc3448bc -> ff76078b6


http://git-wip-us.apache.org/repos/asf/drill/blob/ff76078b/exec/java-exec/src/test/java/org/apache/drill/TestFunctionsQuery.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/TestFunctionsQuery.java b/exec/java-exec/src/test/java/org/apache/drill/TestFunctionsQuery.java
index 641cf9d..24021f8 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/TestFunctionsQuery.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/TestFunctionsQuery.java
@@ -593,7 +593,7 @@ public class TestFunctionsQuery extends BaseTestQuery {
         .sqlQuery(query)
         .unOrdered()
         .baselineColumns("hash_date", "hash_dec9", "hash_dec38")
-        .baselineValues(818600896, 262164233, 1799649913)
+        .baselineValues(312993367, 292570647, 337328302)
         .go();
   }
 
@@ -844,6 +844,29 @@ public class TestFunctionsQuery extends BaseTestQuery {
         .go();
   }
 
+  /*
+   * hash32 version of the above test
+   */
+  @Test
+  public void testHash32() throws Exception {
+    String query = "select " +
+        "hash32AsDouble(cast(employee_id as int)) = hash32AsDouble(cast(employee_id as bigint))
col1, " +
+        "hash32AsDouble(cast(employee_id as bigint)) = hash32AsDouble(cast(employee_id as
float)) col2, " +
+        "hash32AsDouble(cast(employee_id as float)) = hash32AsDouble(cast(employee_id as
double)) col3, " +
+        "hash32AsDouble(cast(employee_id as double)) = hash32AsDouble(cast(employee_id as
decimal(9, 0))) col4, " +
+        "hash32AsDouble(cast(employee_id as decimal(9, 0))) = hash32AsDouble(cast(employee_id
as decimal(18, 0))) col5, " +
+        "hash32AsDouble(cast(employee_id as decimal(18, 0))) = hash32AsDouble(cast(employee_id
as decimal(28, 0))) col6, " +
+        "hash32AsDouble(cast(employee_id as decimal(28, 0))) = hash32AsDouble(cast(employee_id
as decimal(38, 0))) col7 " +
+        "from cp.`employee.json` where employee_id = 1";
+
+    testBuilder()
+        .sqlQuery(query)
+        .unOrdered()
+        .baselineColumns("col1", "col2", "col3", "col4", "col5", "col6", "col7")
+        .baselineValues(true, true, true, true, true, true, true)
+        .go();
+  }
+
   @Test
   public void testImplicitCastVarcharToDouble() throws Exception {
     // tests implicit cast from varchar to double

http://git-wip-us.apache.org/repos/asf/drill/blob/ff76078b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestLocalExchange.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestLocalExchange.java
b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestLocalExchange.java
index 09f8fcb..40e4cab 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestLocalExchange.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestLocalExchange.java
@@ -208,7 +208,7 @@ public class TestLocalExchange extends PlanTestBase {
     final String plan = getPlanInString("EXPLAIN PLAN FOR " + groupByMultipleQuery, JSON_FORMAT);
     System.out.println("Plan: " + plan);
 
-    jsonExchangeOrderChecker(plan, false, 1, "castint\\(hash64asdouble\\(.*, hash64asdouble\\(.*,
hash64asdouble\\(.*\\) \\) \\) \\) ");
+    jsonExchangeOrderChecker(plan, false, 1, "hash32asdouble\\(.*, hash32asdouble\\(.*, hash32asdouble\\(.*\\)
\\) \\) ");
 
     // Run the query and verify the output
     final TestBuilder testBuilder = testBuilder()
@@ -286,7 +286,7 @@ public class TestLocalExchange extends PlanTestBase {
     if ( isMuxOn ) {
       // # of hash exchanges should be = # of mux exchanges + # of demux exchanges
       assertEquals("HashExpr on the hash column should not happen", 2*expectedNumMuxes+expectedNumDeMuxes,
StringUtils.countMatches(plan, HASH_EXPR_NAME));
-      jsonExchangeOrderChecker(plan, isDeMuxOn, expectedNumMuxes, "castint\\(hash64asdouble\\(.*\\)
\\) ");
+      jsonExchangeOrderChecker(plan, isDeMuxOn, expectedNumMuxes, "hash32asdouble\\(.*\\)
");
     } else {
       assertEquals("HashExpr on the hash column should not happen", 0, StringUtils.countMatches(plan,
HASH_EXPR_NAME));
     }


Mime
View raw message