Skip to content

Commit

Permalink
add ut test
Browse files Browse the repository at this point in the history
  • Loading branch information
seawinde committed Dec 25, 2023
1 parent 713cd0d commit 28fae24
Showing 1 changed file with 29 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ public void inferPredicatesTest04() {
logicalJoin(
logicalFilter(
logicalOlapScan()
).when(filter -> filter.getPredicate().toSql().contains("id IN (1, 2, 3)")),
).when(filter -> !ExpressionUtils.isInferred(filter.getPredicate())
& filter.getPredicate().toSql().contains("id IN (1, 2, 3)")),
logicalOlapScan()
)
)
Expand Down Expand Up @@ -247,7 +248,8 @@ public void inferPredicatesTest08() {
logicalOlapScan(),
logicalFilter(
logicalOlapScan()
).when(filter -> filter.getPredicate().toSql().contains("sid > 1"))
).when(filter -> ExpressionUtils.isInferred(filter.getPredicate())
& filter.getPredicate().toSql().contains("sid > 1"))
)
)
);
Expand Down Expand Up @@ -317,7 +319,8 @@ public void inferPredicatesTest11() {
),
logicalFilter(
logicalOlapScan()
).when(filter -> filter.getPredicate().toSql().contains("sid > 1"))
).when(filter -> ExpressionUtils.isInferred(filter.getPredicate())
& filter.getPredicate().toSql().contains("sid > 1"))
)
)
);
Expand Down Expand Up @@ -441,7 +444,8 @@ public void inferPredicatesTest16() {
logicalProject(
logicalFilter(
logicalOlapScan()
).when(filter -> filter.getPredicate().toSql().contains("sid > 1"))
).when(filter -> ExpressionUtils.isInferred(filter.getPredicate())
& filter.getPredicate().toSql().contains("sid > 1"))
)
)
)
Expand All @@ -462,7 +466,8 @@ public void inferPredicatesTest17() {
logicalProject(
logicalFilter(
logicalOlapScan()
).when(filter -> filter.getPredicate().toSql().contains("sid > 1"))
).when(filter -> !ExpressionUtils.isInferred(filter.getPredicate())
& filter.getPredicate().toSql().contains("sid > 1"))
)
)
)
Expand Down Expand Up @@ -528,19 +533,22 @@ public void inferPredicatesTest19() {
logicalJoin(
logicalFilter(
logicalOlapScan()
).when(filter -> filter.getPredicate().toSql().contains("k1 = 3")),
).when(filter -> ExpressionUtils.isInferred(filter.getPredicate())
& filter.getPredicate().toSql().contains("k1 = 3")),
logicalProject(
logicalJoin(
logicalJoin(
logicalProject(
logicalFilter(
logicalOlapScan()
).when(filter -> filter.getPredicate().toSql().contains("k3 = 3"))
).when(filter -> ExpressionUtils.isInferred(filter.getPredicate())
& filter.getPredicate().toSql().contains("k3 = 3"))
),
logicalProject(
logicalFilter(
logicalOlapScan()
).when(filter -> filter.getPredicate().toSql().contains("k1 = 3"))
).when(filter -> !ExpressionUtils.isInferred(filter.getPredicate())
& filter.getPredicate().toSql().contains("k1 = 3"))
)
),
logicalAggregate(
Expand Down Expand Up @@ -568,10 +576,12 @@ public void inferPredicatesTest20() {
innerLogicalJoin(
logicalFilter(
logicalOlapScan()
).when(filter -> filter.getPredicate().toSql().contains("id > 1")),
).when(filter -> ExpressionUtils.isInferred(filter.getPredicate())
& filter.getPredicate().toSql().contains("id > 1")),
logicalFilter(
logicalOlapScan()
).when(filter -> filter.getPredicate().toSql().contains("sid > 1"))
).when(filter -> !ExpressionUtils.isInferred(filter.getPredicate())
& filter.getPredicate().toSql().contains("sid > 1"))
),
logicalFilter(
logicalOlapScan()
Expand All @@ -594,10 +604,12 @@ public void inferPredicatesTest21() {
logicalJoin(
logicalFilter(
logicalOlapScan()
).when(filter -> filter.getPredicate().toSql().contains("id > 1")),
).when(filter -> ExpressionUtils.isInferred(filter.getPredicate())
& filter.getPredicate().toSql().contains("id > 1")),
logicalFilter(
logicalOlapScan()
).when(filter -> filter.getPredicate().toSql().contains("sid > 1"))
).when(filter -> !ExpressionUtils.isInferred(filter.getPredicate())
& filter.getPredicate().toSql().contains("sid > 1"))
),
logicalFilter(
logicalOlapScan()
Expand All @@ -622,11 +634,13 @@ public void inferPredicatesTest22() {
logicalJoin(
logicalFilter(
logicalOlapScan()
).when(filter -> filter.getPredicate().toSql().contains("id > 1")),
).when(filter -> ExpressionUtils.isInferred(filter.getPredicate())
& filter.getPredicate().toSql().contains("id > 1")),
logicalProject(
logicalFilter(
logicalOlapScan()
).when(filter -> filter.getPredicate().toSql().contains("sid > 1"))
).when(filter -> !ExpressionUtils.isInferred(filter.getPredicate())
& filter.getPredicate().toSql().contains("sid > 1"))
)
)
)
Expand All @@ -650,6 +664,7 @@ public void innerJoinShouldNotInferUnderLeftJoinOnClausePredicates() {
logicalFilter(
logicalOlapScan()
).when(filter -> filter.getConjuncts().size() == 1
&& !ExpressionUtils.isInferred(filter.getPredicate())
&& filter.getPredicate().toSql().contains("id = 2")),
any()
).when(join -> join.getJoinType() == JoinType.LEFT_OUTER_JOIN)
Expand Down

0 comments on commit 28fae24

Please sign in to comment.