drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vkorukanti <...@git.apache.org>
Subject [GitHub] drill pull request: DRILL-4539: Add support for Null Equality Join...
Date Wed, 06 Apr 2016 18:30:12 GMT
Github user vkorukanti commented on a diff in the pull request:

    https://github.com/apache/drill/pull/462#discussion_r58757405
  
    --- Diff: exec/java-exec/src/test/java/org/apache/drill/TestJoinNullable.java ---
    @@ -407,11 +342,94 @@ public void testMergeLOJNullableBothInputsOrderedDescNullsLastVsAscNullsLast()
t
                 + "         ORDER BY 1 ASC NULLS LAST  ) t2 "
                 + "    USING ( key )",
                 TEST_RES_PATH, TEST_RES_PATH);
    -    final int expectedRecordCount = 6;
    +    testHelper(query, 6, false, true);
    +  }
    +
    +  @Test
    +  public void withDistinctFromJoinConditionHashJoin() throws Exception {
    +    final String query = "SELECT * FROM " +
    +            "cp.`jsonInput/nullableOrdered1.json` t1 JOIN " +
    +            "cp.`jsonInput/nullableOrdered2.json` t2 " +
    +            "ON t1.key IS NOT DISTINCT FROM t2.key AND t1.data is NOT null";
    +    nullEqualJoinHelper(query);
    +  }
    +
    +  @Test
    +  public void withDistinctFromJoinConditionMergeJoin() throws Exception {
    +    try {
    +      test("alter session set `planner.enable_hashjoin` = false");
    +      final String query = "SELECT * FROM " +
    +              "cp.`jsonInput/nullableOrdered1.json` t1 JOIN " +
    +              "cp.`jsonInput/nullableOrdered2.json` t2 " +
    +              "ON t1.key IS NOT DISTINCT FROM t2.key";
    +      nullEqualJoinHelper(query);
    +    } finally {
    +      test("alter session set `planner.enable_hashjoin` = true");
    +    }
    +  }
    +
    +  @Test
    +  public void withNullEqualHashJoin() throws Exception {
    +    final String query = "SELECT * FROM " +
    +            "cp.`jsonInput/nullableOrdered1.json` t1 JOIN " +
    +            "cp.`jsonInput/nullableOrdered2.json` t2 " +
    +            "ON t1.key = t2.key OR (t1.key IS NULL AND t2.key IS NULL)";
    +    nullEqualJoinHelper(query);
    +  }
     
    -    enableJoin(false, true);
    -    final int actualRecordCount = testSql(query);
    -    assertEquals("Number of output rows", expectedRecordCount, actualRecordCount);
    +  @Test
    +  public void withNullEqualMergeJoin() throws Exception {
    +    try {
    +      test("alter session set `planner.enable_hashjoin` = false");
    +      final String query = "SELECT * FROM " +
    +          "cp.`jsonInput/nullableOrdered1.json` t1 JOIN " +
    +          "cp.`jsonInput/nullableOrdered2.json` t2 " +
    +          "ON t1.key = t2.key OR (t1.key IS NULL AND t2.key IS NULL)";
    +      nullEqualJoinHelper(query);
    +    } finally {
    +      test("alter session set `planner.enable_hashjoin` = true");
    +    }
    +  }
    +
    +  public void nullEqualJoinHelper(final String query) throws Exception {
    +    testBuilder()
    +        .sqlQuery(query)
    +        .unOrdered()
    +        .baselineColumns("key", "data", "data0", "key0")
    +        .baselineValues(null, "L_null_1", "R_null_1", null)
    +        .baselineValues(null, "L_null_2", "R_null_1", null)
    +        .baselineValues("A", "L_A_1", "R_A_1", "A")
    +        .baselineValues("A", "L_A_2", "R_A_1", "A")
    +        .baselineValues(null, "L_null_1", "R_null_2", null)
    +        .baselineValues(null, "L_null_2", "R_null_2", null)
    +        .baselineValues(null, "L_null_1", "R_null_3", null)
    +        .baselineValues(null, "L_null_2", "R_null_3", null)
    +        .go();
       }
     
    +  @Test
    +  public void withNullEqualAdditionFilter() throws Exception {
    --- End diff --
    
    Sure. I will update the patch with new tests.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message