Skip to content

Commit

Permalink
apache#3414 Compare expression is not working
Browse files Browse the repository at this point in the history
  • Loading branch information
navis committed Sep 24, 2020
1 parent 9e170fa commit 81cedb9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion common/src/main/java/io/druid/math/expr/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ public Expr visit(BinaryOp op, Expr left, Expr right)
}
}
final TypedSupplier supplier1 = values.getOrDefault(id1, TypedSupplier.UNKNOWN);
final TypedSupplier supplier2 = values.getOrDefault(id1, TypedSupplier.UNKNOWN);
final TypedSupplier supplier2 = values.getOrDefault(id2, TypedSupplier.UNKNOWN);
if (supplier1.type().isPrimitive() && Objects.equals(supplier1.type(), supplier2.type())) {
final BooleanBinaryOp rewritten = rewrite(op.op, supplier1, supplier2, supplier1.type().comparator());
if (rewritten != null) {
Expand Down
11 changes: 9 additions & 2 deletions sql/src/test/java/io/druid/sql/calcite/TpchTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6527,7 +6527,14 @@ public void tpch22() throws Exception
+ " \"druid.sql.planner.maxSemiJoinRowsInMemory\" : \"-1;\"\n"
+ " },\n"
+ " \"descending\" : false\n"
+ "}"
+ "}",
new Object[]{"13", 5L, 37676.7D},
new Object[]{"17", 5L, 41431.74D},
new Object[]{"18", 7L, 51351.03D},
new Object[]{"23", 2L, 18148.870000000003D},
new Object[]{"29", 6L, 47247.25D},
new Object[]{"30", 9L, 65584.23D},
new Object[]{"31", 7L, 53270.52999999999D}
);
}
}
}

0 comments on commit 81cedb9

Please sign in to comment.