Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/src/main/java/org/apache/calcite/rex/RexUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -2967,7 +2967,7 @@ private RexNode pull(RexNode rex) {
}
return and(Iterables.concat(factors.values(), ImmutableList.of(or(list))));
default:
return normalizeComparison(rex);
return rex;
}
}

Expand All @@ -2994,7 +2994,7 @@ private LinkedHashMap<RexNode, RexNode> commonFactors(List<RexNode> nodes) {
if (i++ == 0) {
for (RexNode conjunction : RelOptUtil.conjunctions(node)) {
RexNode normalized = normalizeComparison(conjunction);
map.put(normalized, normalized);
map.put(normalized, conjunction);
}
} else {
map.keySet().retainAll(
Expand Down
8 changes: 4 additions & 4 deletions core/src/test/java/org/apache/calcite/rex/RexProgramTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -896,13 +896,13 @@ private void checkExponentialCnf(int n) {
final RexNode bool0 = rexBuilder.makeInputRef(booleanType, 0);
final RexNode bool1 = rexBuilder.makeInputRef(booleanType, 1);
final RexNode seven = literal(7);
checkPullFactors(eq(ref6, ref3), "=($3, $6)");
checkPullFactors(gt(ref6, ref3), "<($3, $6)");
checkPullFactors(le(seven, ref3), ">=($3, 7)");
checkPullFactors(eq(ref6, ref3), "=($6, $3)");
checkPullFactors(gt(ref6, ref3), ">($6, $3)");
checkPullFactors(le(seven, ref3), "<=(7, $3)");
checkPullFactors(
or(and(eq(ref6, ref3), bool0),
and(eq(ref3, ref6), bool1)),
"AND(=($3, $6), OR($0, $1))");
"AND(=($6, $3), OR($0, $1))");
}

@Test void testSimplify() {
Expand Down
Loading