You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "snuyanzin (via GitHub)" <gi...@apache.org> on 2024/12/12 08:56:30 UTC

[PR] [FLINK-36896] Table API trim expression incorrectly translated to SQL [flink]

snuyanzin opened a new pull request, #25791:
URL: https://github.com/apache/flink/pull/25791

   
   ## What is the purpose of the change
   
   While translation of `trim()` to SQL parenthesis are missed
   
   ## Brief change log
   
   `SqlCallSyntax`
   
   ## Verifying this change
   `ExpressionSerializationTest.java`
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): ( no)
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: ( no)
     - The serializers: (no)
     - The runtime per-record code paths (performance sensitive): ( no)
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (no)
     - The S3 file system connector: (no)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? (no)
     - If yes, how is the feature documented? (not applicable)
   


-- 
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


Re: [PR] [FLINK-36896][table] Table API trim expression incorrectly translated to SQL [flink]

Posted by "flinkbot (via GitHub)" <gi...@apache.org>.
flinkbot commented on PR #25791:
URL: https://github.com/apache/flink/pull/25791#issuecomment-2538287677

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "fe52760343c6d429d8a586dda10a37030a3dbf98",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "fe52760343c6d429d8a586dda10a37030a3dbf98",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * fe52760343c6d429d8a586dda10a37030a3dbf98 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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


Re: [PR] [FLINK-36896][table] Table API trim expression incorrectly translated to SQL [flink]

Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin commented on code in PR #25791:
URL: https://github.com/apache/flink/pull/25791#discussion_r1881898765


##########
flink-table/flink-table-api-java/src/test/java/org/apache/flink/table/expressions/ExpressionSerializationTest.java:
##########
@@ -172,13 +172,13 @@ public static Stream<TestSpec> testData() {
                         .expectStr("POSITION(`f0` IN 'ABC')"),
                 TestSpec.forExpr($("f0").trim("ABC"))
                         .withField("f0", DataTypes.STRING())
-                        .expectStr("TRIM BOTH 'ABC' FROM `f0`"),
+                        .expectStr("TRIM(BOTH 'ABC' FROM `f0`)"),
                 TestSpec.forExpr($("f0").trimLeading("ABC"))
                         .withField("f0", DataTypes.STRING())
-                        .expectStr("TRIM LEADING 'ABC' FROM `f0`"),
+                        .expectStr("TRIM(LEADING 'ABC' FROM `f0`)"),
                 TestSpec.forExpr($("f0").trimTrailing("ABC"))
                         .withField("f0", DataTypes.STRING())
-                        .expectStr("TRIM TRAILING 'ABC' FROM `f0`"),
+                        .expectStr("TRIM(TRAILING 'ABC' FROM `f0`)"),
                 TestSpec.forExpr($("f0").overlay("ABC", 2))

Review Comment:
   there are sql and table api
   which of them are you talking about?
   sql is in left column in contains
   ```sql
   TRIM([ BOTH | LEADING | TRAILING ] string1 FROM string2) 
   ```
   table api among others contains what you've mentioned



-- 
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


Re: [PR] [FLINK-36896][table] Table API trim expression incorrectly translated to SQL [flink]

Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin merged PR #25791:
URL: https://github.com/apache/flink/pull/25791


-- 
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


Re: [PR] [FLINK-36896][table] Table API trim expression incorrectly translated to SQL [flink]

Posted by "davidradl (via GitHub)" <gi...@apache.org>.
davidradl commented on code in PR #25791:
URL: https://github.com/apache/flink/pull/25791#discussion_r1881885344


##########
flink-table/flink-table-api-java/src/test/java/org/apache/flink/table/expressions/ExpressionSerializationTest.java:
##########
@@ -172,13 +172,13 @@ public static Stream<TestSpec> testData() {
                         .expectStr("POSITION(`f0` IN 'ABC')"),
                 TestSpec.forExpr($("f0").trim("ABC"))
                         .withField("f0", DataTypes.STRING())
-                        .expectStr("TRIM BOTH 'ABC' FROM `f0`"),
+                        .expectStr("TRIM(BOTH 'ABC' FROM `f0`)"),
                 TestSpec.forExpr($("f0").trimLeading("ABC"))
                         .withField("f0", DataTypes.STRING())
-                        .expectStr("TRIM LEADING 'ABC' FROM `f0`"),
+                        .expectStr("TRIM(LEADING 'ABC' FROM `f0`)"),
                 TestSpec.forExpr($("f0").trimTrailing("ABC"))
                         .withField("f0", DataTypes.STRING())
-                        .expectStr("TRIM TRAILING 'ABC' FROM `f0`"),
+                        .expectStr("TRIM(TRAILING 'ABC' FROM `f0`)"),
                 TestSpec.forExpr($("f0").overlay("ABC", 2))

Review Comment:
   I am looking at the docs [https://nightlies.apache.org/flink/flink-docs-release-1.20/docs/dev/table/functions/systemfunctions/](https://nightlies.apache.org/flink/flink-docs-release-1.20/docs/dev/table/functions/systemfunctions/) I see the syntax as `STRING1.trim(LEADING, STRING2)` and the like - I am not seeing FROM syntax I see here. Or is this syntax part of the table planner representation of this function. 



-- 
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