You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "lincoln-lil (via GitHub)" <gi...@apache.org> on 2023/10/11 04:45:12 UTC

Re: [PR] [FLINK-33171][table planner] Table SQL support Not Equal for TimePoint type and TimeString [flink]

lincoln-lil commented on code in PR #23478:
URL: https://github.com/apache/flink/pull/23478#discussion_r1353989534


##########
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/codegen/calls/ScalarOperatorGens.scala:
##########
@@ -488,6 +488,18 @@ object ScalarOperatorGens {
     else if (isNumeric(left.resultType) && isNumeric(right.resultType)) {
       generateComparison(ctx, "!=", left, right, resultType)
     }
+    // support date/time/timestamp not equalTo string.
+    else if (
+      (isTimePoint(left.resultType) && isCharacterString(right.resultType)) ||

Review Comment:
   Can we add optimizations for string literals similar to the handling of `generateEquals`?



##########
flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/expressions/ScalarOperatorsTest.scala:
##########
@@ -228,6 +228,15 @@ class ScalarOperatorsTest extends ScalarOperatorsTestBase {
     testSqlApi("uuid() = cast(f22 as timestamp_ltz)", "NULL")
   }
 
+  @Test
+  def testTimePointTypeNotEqualsStringType(): Unit = {
+    testSqlApi("f22 = '1996-11-10 12:34:56'", "TRUE")

Review Comment:
   I see that the datetime family contains 5 datatypes(see `org.apache.flink.table.types.logical.LogicalTypeRoot`), so it is recommended to add more tests for complete coverage of the datatypes



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org