aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolodymyr Vysotskyi <vvovyk@gmail.com>2019-03-03 14:52:27 +0200
committerkarthik <kmanivannan@maprtech.com>2019-03-08 12:21:44 -0800
commit6bd31f33c137e56912bcea04c5b993eafc64a20a (patch)
treed397c597ac9fe8e1ab4c2c438288cba5ee2f0253
parent619a49943ba33e4ad1ba2dc754c65cfa2708e936 (diff)
DRILL-7072: Query with semi join fails for JDBC storage plugin
closes #1674
-rw-r--r--contrib/storage-jdbc/src/test/java/org/apache/drill/exec/store/jdbc/TestJdbcPluginWithMySQLIT.java15
-rw-r--r--exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillSemiJoinRule.java4
2 files changed, 17 insertions, 2 deletions
diff --git a/contrib/storage-jdbc/src/test/java/org/apache/drill/exec/store/jdbc/TestJdbcPluginWithMySQLIT.java b/contrib/storage-jdbc/src/test/java/org/apache/drill/exec/store/jdbc/TestJdbcPluginWithMySQLIT.java
index 049ee6022..cd6b4b841 100644
--- a/contrib/storage-jdbc/src/test/java/org/apache/drill/exec/store/jdbc/TestJdbcPluginWithMySQLIT.java
+++ b/contrib/storage-jdbc/src/test/java/org/apache/drill/exec/store/jdbc/TestJdbcPluginWithMySQLIT.java
@@ -308,4 +308,19 @@ public class TestJdbcPluginWithMySQLIT extends ClusterTest {
.baselineValues(5, 5)
.go();
}
+
+ @Test
+ public void testSemiJoin() throws Exception {
+ String query =
+ "select person_id from mysql.`drill_mysql_test`.person t1\n" +
+ "where exists (" +
+ "select person_id from mysql.`drill_mysql_test`.person\n" +
+ "where t1.person_id = person_id)";
+ testBuilder()
+ .sqlQuery(query)
+ .unOrdered()
+ .baselineColumns("person_id")
+ .baselineValuesForSingleColumn(1, 2, 3, 5)
+ .go();
+ }
}
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillSemiJoinRule.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillSemiJoinRule.java
index 257f5383f..8e1cdd0a3 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillSemiJoinRule.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillSemiJoinRule.java
@@ -41,7 +41,7 @@ import java.util.function.Predicate;
/**
* Planner rule that creates a {@code DrillSemiJoinRel} from a
* {@link org.apache.calcite.rel.core.Join} on top of a
- * {@link org.apache.calcite.rel.logical.LogicalAggregate}.
+ * {@link org.apache.calcite.rel.core.Aggregate}.
*/
public abstract class DrillSemiJoinRule extends RelOptRule {
private static final Predicate<Join> IS_LEFT_OR_INNER =
@@ -168,7 +168,7 @@ public abstract class DrillSemiJoinRule extends RelOptRule {
@Override
public boolean matches(RelOptRuleCall call) {
Join join = call.rel(0);
- DrillAggregateRel agg = call.rel(2);
+ Aggregate agg = call.rel(2);
if (agg.getAggCallList().size() != 0) { return false; }
return isSimpleJoinCondition(join.getCondition()) &&
isRowTypeSame(join, call.rel(1), call.rel(2).getInput(0));