You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2021/03/24 13:18:32 UTC

[GitHub] [flink] leonardBang opened a new pull request #15363: [FLINK-21715][table-planner] Support implicit cast conversion between timestamp and timestamp_ltz

leonardBang opened a new pull request #15363:
URL: https://github.com/apache/flink/pull/15363


   ## What is the purpose of the change
   
   * This pull request to ensure the user defined function can still be used after the parameter type changes from TIMESTAMP type to TIMESTAMP_LTZ 
    
   ## Brief change log
     -   Support Implicit cast conversion between timestamp and timestamp_ltz
   
   ## Verifying this change
    - add Unit test and ITCase to cover the change
   
   This change is a trivial rework / code cleanup without any test coverage.
   
   ## 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, Yarn/Mesos, 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 / docs / JavaDocs / not documented)
   


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

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



[GitHub] [flink] flinkbot edited a comment on pull request #15363: [FLINK-21715][table-planner] Support implicit cast conversion between timestamp and timestamp_ltz

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #15363:
URL: https://github.com/apache/flink/pull/15363#issuecomment-805833999


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "08d259b19b62b27c6f6425bf940e9bbe21d1b010",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=15390",
       "triggerID" : "08d259b19b62b27c6f6425bf940e9bbe21d1b010",
       "triggerType" : "PUSH"
     }, {
       "hash" : "4ff2b910dc757f0866be45171601695cb513285d",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "4ff2b910dc757f0866be45171601695cb513285d",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 08d259b19b62b27c6f6425bf940e9bbe21d1b010 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=15390) 
   * 4ff2b910dc757f0866be45171601695cb513285d UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@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.

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



[GitHub] [flink] flinkbot commented on pull request #15363: [FLINK-21715][table-planner] Support implicit cast conversion between timestamp and timestamp_ltz

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #15363:
URL: https://github.com/apache/flink/pull/15363#issuecomment-805833999


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "08d259b19b62b27c6f6425bf940e9bbe21d1b010",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "08d259b19b62b27c6f6425bf940e9bbe21d1b010",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 08d259b19b62b27c6f6425bf940e9bbe21d1b010 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@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.

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



[GitHub] [flink] flinkbot edited a comment on pull request #15363: [FLINK-21715][table-planner] Support implicit cast conversion between timestamp and timestamp_ltz

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #15363:
URL: https://github.com/apache/flink/pull/15363#issuecomment-805833999


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "08d259b19b62b27c6f6425bf940e9bbe21d1b010",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=15390",
       "triggerID" : "08d259b19b62b27c6f6425bf940e9bbe21d1b010",
       "triggerType" : "PUSH"
     }, {
       "hash" : "4ff2b910dc757f0866be45171601695cb513285d",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=15536",
       "triggerID" : "4ff2b910dc757f0866be45171601695cb513285d",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 4ff2b910dc757f0866be45171601695cb513285d Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=15536) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@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.

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



[GitHub] [flink] flinkbot edited a comment on pull request #15363: [FLINK-21715][table-planner] Support implicit cast conversion between timestamp and timestamp_ltz

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #15363:
URL: https://github.com/apache/flink/pull/15363#issuecomment-805833999


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "08d259b19b62b27c6f6425bf940e9bbe21d1b010",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=15390",
       "triggerID" : "08d259b19b62b27c6f6425bf940e9bbe21d1b010",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 08d259b19b62b27c6f6425bf940e9bbe21d1b010 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=15390) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@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.

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



[GitHub] [flink] flinkbot edited a comment on pull request #15363: [FLINK-21715][table-planner] Support implicit cast conversion between timestamp and timestamp_ltz

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #15363:
URL: https://github.com/apache/flink/pull/15363#issuecomment-805833999


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "08d259b19b62b27c6f6425bf940e9bbe21d1b010",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=15390",
       "triggerID" : "08d259b19b62b27c6f6425bf940e9bbe21d1b010",
       "triggerType" : "PUSH"
     }, {
       "hash" : "4ff2b910dc757f0866be45171601695cb513285d",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=15536",
       "triggerID" : "4ff2b910dc757f0866be45171601695cb513285d",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 08d259b19b62b27c6f6425bf940e9bbe21d1b010 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=15390) 
   * 4ff2b910dc757f0866be45171601695cb513285d Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=15536) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@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.

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



[GitHub] [flink] flinkbot commented on pull request #15363: [FLINK-21715][table-planner] Support implicit cast conversion between timestamp and timestamp_ltz

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #15363:
URL: https://github.com/apache/flink/pull/15363#issuecomment-805814730


   Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
   to review your pull request. We will use this comment to track the progress of the review.
   
   
   ## Automated Checks
   Last check on commit 08d259b19b62b27c6f6425bf940e9bbe21d1b010 (Wed Mar 24 13:21:11 UTC 2021)
   
   **Warnings:**
    * No documentation files were touched! Remember to keep the Flink docs up to date!
   
   
   <sub>Mention the bot in a comment to re-run the automated checks.</sub>
   ## Review Progress
   
   * ❓ 1. The [description] looks good.
   * ❓ 2. There is [consensus] that the contribution should go into to Flink.
   * ❓ 3. Needs [attention] from.
   * ❓ 4. The change fits into the overall [architecture].
   * ❓ 5. Overall code [quality] is good.
   
   Please see the [Pull Request Review Guide](https://flink.apache.org/contributing/reviewing-prs.html) for a full explanation of the review process.<details>
    The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot approve description` to approve one or more aspects (aspects: `description`, `consensus`, `architecture` and `quality`)
    - `@flinkbot approve all` to approve all aspects
    - `@flinkbot approve-until architecture` to approve everything until `architecture`
    - `@flinkbot attention @username1 [@username2 ..]` to require somebody's attention
    - `@flinkbot disapprove architecture` to remove an approval you gave earlier
   </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.

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



[GitHub] [flink] wuchong commented on a change in pull request #15363: [FLINK-21715][table-planner] Support implicit cast conversion between timestamp and timestamp_ltz

Posted by GitBox <gi...@apache.org>.
wuchong commented on a change in pull request #15363:
URL: https://github.com/apache/flink/pull/15363#discussion_r602071178



##########
File path: flink-table/flink-table-common/src/test/java/org/apache/flink/table/types/LogicalTypeCastsTest.java
##########
@@ -155,7 +157,41 @@
                         new VarCharType(Integer.MAX_VALUE),
                         false,
                         false
-                    }
+                    },
+                    {
+                        new RowType(
+                                Arrays.asList(
+                                        new RowField("f1", new IntType()),
+                                        new RowField("f2", new IntType()))),
+                        new VarCharType(Integer.MAX_VALUE),
+                        false,
+                        false
+                    },
+                    // test implicit cast between timestamp type and timestamp_ltz type
+                    {new TimestampType(9), new TimestampType(9), true, true},
+                    {new LocalZonedTimestampType(9), new LocalZonedTimestampType(9), true, true},
+                    {new TimestampType(3), new LocalZonedTimestampType(3), true, true},
+                    {new LocalZonedTimestampType(3), new TimestampType(3), true, true},
+                    {new TimestampType(3), new LocalZonedTimestampType(6), true, true},
+                    {new LocalZonedTimestampType(3), new TimestampType(6), true, true},
+                    {new TimestampType(3), new LocalZonedTimestampType(6), true, true},

Review comment:
       duplicate. 

##########
File path: flink-table/flink-table-common/src/test/java/org/apache/flink/table/types/LogicalTypeCastsTest.java
##########
@@ -155,7 +157,41 @@
                         new VarCharType(Integer.MAX_VALUE),
                         false,
                         false
-                    }
+                    },
+                    {
+                        new RowType(
+                                Arrays.asList(
+                                        new RowField("f1", new IntType()),
+                                        new RowField("f2", new IntType()))),
+                        new VarCharType(Integer.MAX_VALUE),
+                        false,
+                        false
+                    },

Review comment:
       This is duplicated. 

##########
File path: flink-table/flink-table-common/src/test/java/org/apache/flink/table/types/LogicalTypeCastsTest.java
##########
@@ -155,7 +157,41 @@
                         new VarCharType(Integer.MAX_VALUE),
                         false,
                         false
-                    }
+                    },
+                    {
+                        new RowType(
+                                Arrays.asList(
+                                        new RowField("f1", new IntType()),
+                                        new RowField("f2", new IntType()))),
+                        new VarCharType(Integer.MAX_VALUE),
+                        false,
+                        false
+                    },
+                    // test implicit cast between timestamp type and timestamp_ltz type
+                    {new TimestampType(9), new TimestampType(9), true, true},
+                    {new LocalZonedTimestampType(9), new LocalZonedTimestampType(9), true, true},
+                    {new TimestampType(3), new LocalZonedTimestampType(3), true, true},
+                    {new LocalZonedTimestampType(3), new TimestampType(3), true, true},
+                    {new TimestampType(3), new LocalZonedTimestampType(6), true, true},
+                    {new LocalZonedTimestampType(3), new TimestampType(6), true, true},
+                    {new TimestampType(3), new LocalZonedTimestampType(6), true, true},
+                    {new LocalZonedTimestampType(3), new TimestampType(6), true, true},

Review comment:
       duplicate.

##########
File path: flink-table/flink-table-common/src/test/java/org/apache/flink/table/types/LogicalTypeCastsTest.java
##########
@@ -155,7 +157,41 @@
                         new VarCharType(Integer.MAX_VALUE),
                         false,
                         false
-                    }
+                    },
+                    {
+                        new RowType(
+                                Arrays.asList(
+                                        new RowField("f1", new IntType()),
+                                        new RowField("f2", new IntType()))),
+                        new VarCharType(Integer.MAX_VALUE),
+                        false,
+                        false
+                    },
+                    // test implicit cast between timestamp type and timestamp_ltz type
+                    {new TimestampType(9), new TimestampType(9), true, true},
+                    {new LocalZonedTimestampType(9), new LocalZonedTimestampType(9), true, true},
+                    {new TimestampType(3), new LocalZonedTimestampType(3), true, true},
+                    {new LocalZonedTimestampType(3), new TimestampType(3), true, true},
+                    {new TimestampType(3), new LocalZonedTimestampType(6), true, true},
+                    {new LocalZonedTimestampType(3), new TimestampType(6), true, true},
+                    {new TimestampType(3), new LocalZonedTimestampType(6), true, true},
+                    {new LocalZonedTimestampType(3), new TimestampType(6), true, true},
+                    {new TimestampType(false, 3), new LocalZonedTimestampType(6), true, true},
+                    {new LocalZonedTimestampType(false, 3), new TimestampType(6), true, true},

Review comment:
       Add tests cast from higher precision to lower precision. 

##########
File path: flink-table/flink-table-planner-blink/src/test/scala/org/apache/flink/table/planner/runtime/batch/sql/CalcITCase.scala
##########
@@ -392,6 +392,34 @@ class CalcITCase extends BatchTestBase {
         Timestamp.valueOf("2019-09-19 08:03:09").toInstant)))
   }
 
+  @Test
+  def testTimeUDFParametersImplicitCast(): Unit = {
+    val data = Seq(row(
+      localDateTime("2019-09-19 08:03:09"),
+      Timestamp.valueOf("2019-09-19 08:03:09"),
+      Timestamp.valueOf("2019-09-19 08:03:09").toInstant))
+    registerCollection("MyTable", data,
+      new RowTypeInfo(LOCAL_DATE_TIME, TIMESTAMP, INSTANT),
+      "a, b, c")

Review comment:
       Would be better to use DDL to register tables which can explicitly define sql types. We can also add different precision columns, e.g. 
   
   ```scala
       val ddl =
         """
           |CREATE TABLE src (
           |  ntz TIMESTAMP(3),
           |  ltz0 TIMESTAMP_LTZ(0),
           |  ltz3 TIMESTAMP_LTZ(3),
           |  ltz6 TIMESTAMP_LTZ(6),
           |  ltz9 TIMESTAMP_LTZ(9),
           |  ltz_not_null TIMESTAMP_LTZ(3) NOT NULL
           |) WITH (
           |  'connector' = 'values',
           |  ...
           |)
           |""".stripMargin
   ``` 




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

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



[GitHub] [flink] wuchong closed pull request #15363: [FLINK-21715][table-planner] Support implicit cast conversion between timestamp and timestamp_ltz

Posted by GitBox <gi...@apache.org>.
wuchong closed pull request #15363:
URL: https://github.com/apache/flink/pull/15363


   


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

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



[GitHub] [flink] flinkbot edited a comment on pull request #15363: [FLINK-21715][table-planner] Support implicit cast conversion between timestamp and timestamp_ltz

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #15363:
URL: https://github.com/apache/flink/pull/15363#issuecomment-805833999


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "08d259b19b62b27c6f6425bf940e9bbe21d1b010",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=15390",
       "triggerID" : "08d259b19b62b27c6f6425bf940e9bbe21d1b010",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 08d259b19b62b27c6f6425bf940e9bbe21d1b010 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=15390) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@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.

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