Skip to content

Commit

Permalink
fix code usage
Browse files Browse the repository at this point in the history
  • Loading branch information
seawinde committed Dec 11, 2024
1 parent e095920 commit 3869a64
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 680 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.apache.doris.nereids.trees.expressions.Expression;
import org.apache.doris.nereids.trees.expressions.Slot;
import org.apache.doris.nereids.trees.expressions.SlotReference;
import org.apache.doris.nereids.trees.expressions.literal.BooleanLiteral;
import org.apache.doris.nereids.util.ExpressionUtils;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
Expand Down Expand Up @@ -67,23 +67,27 @@ private void assetEquals(String expression,

if (!StringUtils.isEmpty(expectedEqualExpr)) {
Expression equalExpression = replaceUnboundSlot(PARSER.parseExpression(expectedEqualExpr), mem);
Assertions.assertEquals(equalExpression, splitPredicate.getEqualPredicateMap());
Assertions.assertEquals(ExpressionUtils.extractConjunctionToSet(equalExpression),
splitPredicate.getEqualPredicateMap().keySet());
} else {
Assertions.assertEquals(splitPredicate.getEqualPredicateMap(), BooleanLiteral.TRUE);
Assertions.assertTrue(splitPredicate.getEqualPredicateMap().isEmpty());
}

if (!StringUtils.isEmpty(expectedRangeExpr)) {
Expression rangeExpression = replaceUnboundSlot(PARSER.parseExpression(expectedRangeExpr), mem);
Assertions.assertEquals(rangeExpression, splitPredicate.getRangePredicate());
Assertions.assertEquals(ExpressionUtils.extractConjunctionToSet(rangeExpression),
splitPredicate.getRangePredicateMap().keySet());
} else {
Assertions.assertEquals(splitPredicate.getRangePredicate(), BooleanLiteral.TRUE);
Assertions.assertTrue(splitPredicate.getRangePredicateMap().isEmpty());
}

if (!StringUtils.isEmpty(expectedResidualExpr)) {
Expression residualExpression = replaceUnboundSlot(PARSER.parseExpression(expectedResidualExpr), mem);
Assertions.assertEquals(residualExpression, splitPredicate.getResidualPredicateMap());
Assertions.assertEquals(
ExpressionUtils.extractConjunctionToSet(residualExpression),
splitPredicate.getResidualPredicateMap().keySet());
} else {
Assertions.assertEquals(splitPredicate.getResidualPredicateMap(), BooleanLiteral.TRUE);
Assertions.assertTrue(splitPredicate.getResidualPredicateMap().isEmpty());
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,143 +1,33 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !query1_0_before --
b 3

-- !query1_0_after --
b 3

-- !query1_1_before --
b 3

-- !query1_1_after --
b 3

-- !query1_2_before --
b 1

-- !query1_2_after --
b 1

-- !query1_3_before --
b 18

-- !query1_3_after --
b 18

-- !query1_4_before --
b 18

-- !query1_4_after --
b 18

-- !query1_5_before --
b 18

-- !query1_5_after --
b 18

-- !query1_6_before --
-- !query3_2_before --
b 15

-- !query1_6_after --
b 15

-- !query1_7_before --
b 15

-- !query1_7_after --
b 15

-- !query1_8_before --
b 6

-- !query1_8_after --
b 6

-- !query1_9_before --
b 6

-- !query1_9_after --
b 6

-- !query1_10_before --
b 21
d 3

-- !query1_10_after --
b 21
d 3

-- !query1_11_before --
b 21
d 3

-- !query1_11_after --
b 21
d 3

-- !query1_12_before --
b 6

-- !query1_12_after --
b 6

-- !query1_13_before --
b 6

-- !query1_13_after --
b 6

-- !query1_14_before --
b 24
d 3

-- !query1_14_after --
b 24
-- !query3_2_after --
b 15
d 3

-- !query1_15_before --
b 24
-- !query3_3_before --
b 15
d 3

-- !query1_15_after --
b 24
-- !query3_3_after --
b 15
d 3

-- !query2_0_before --
b 6

-- !query2_0_after --
b 6

-- !query2_1_before --

-- !query2_1_after --

-- !query2_2_before --
b 18

-- !query2_2_after --
b 18

-- !query2_3_before --
b 18

-- !query2_3_after --
b 18

-- !query3_0_before --
-- !query3_4_before --
b 15
d 3

-- !query3_0_after --
-- !query3_4_after --
b 15
d 3

-- !query3_1_before --
-- !query3_5_before --
b 15
d 3

-- !query3_1_after --
-- !query3_5_after --
b 15
d 3

Loading

0 comments on commit 3869a64

Please sign in to comment.