godfreyhe commented on a change in pull request #17637:
URL: https://github.com/apache/flink/pull/17637#discussion_r752187675
##########
File path:
flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/plan/rules/logical/ConvertToNotInOrInRule.scala
##########
@@ -18,16 +18,20 @@
package org.apache.flink.table.planner.plan.rules.logical
+import org.apache.flink.table.api.TableException
import org.apache.flink.table.planner.calcite.FlinkTypeFactory
import org.apache.flink.table.types.logical.LogicalTypeRoot
+import com.google.common.collect.{Range, RangeSet, TreeRangeSet}
Review comment:
please remove the useless imports
##########
File path:
flink-table/flink-table-planner-blink/src/test/scala/org/apache/flink/table/planner/plan/rules/logical/ConvertToNotInOrInRuleTest.scala
##########
@@ -169,4 +169,40 @@ class ConvertToNotInOrInRuleTest extends TableTestBase {
"SELECT * FROM MyTable WHERE b = 1 OR b = 2 OR (a <> 1 AND a <> 2 AND a
<> 3 " +
"AND a <> 4 AND c = 1) OR b = 3 OR b = 4 OR c = 1")
}
+
+ @Test
+ def testConvertToSearchString(): Unit = {
+ util.verifyRelPlan(
+ """
+ |SELECT * from MyTable where e in (
+ |'CTNBSmokeSensor',
+ |'H388N',
+ |'H389N ',
+ |'GHL-IRD',
+ |'JY-BF-20YN',
+ |'HC809',
+ |'DH-9908N-AEP',
+ |'DH-9908N'
+ |)
+ |""".stripMargin
+ )
+ }
+
+ @Test
+ def testConvertToSearchString2(): Unit = {
Review comment:
rename to `testConvertToSearchStringWithNull` ?
##########
File path:
flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/calcite/FlinkRexBuilder.java
##########
@@ -95,4 +110,118 @@ public RexNode makeZeroLiteral(RelDataType type) {
return super.makeZeroLiteral(type);
}
}
+
+ /**
+ * Convert the conditions into the {@code IN} and fix [CALCITE-4888]:
Unexpected {@link RexNode}
Review comment:
please add "Once CALCITE-4888 is fixed, this method (and related
methods) should be removed."
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]