You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by "link3280 (via GitHub)" <gi...@apache.org> on 2023/04/22 08:43:41 UTC

[GitHub] [kyuubi] link3280 opened a new pull request, #4751: [KYUUBI #4745] Support Flink's LocalZonedTimestamp DataType

link3280 opened a new pull request, #4751:
URL: https://github.com/apache/kyuubi/pull/4751

   <!--
   Thanks for sending a pull request!
   
   Here are some tips for you:
     1. If this is your first time, please read our contributor guidelines: https://kyuubi.readthedocs.io/en/latest/community/CONTRIBUTING.html
     2. If the PR is related to an issue in https://github.com/apache/kyuubi/issues, add '[KYUUBI #XXXX]' in your PR title, e.g., '[KYUUBI #XXXX] Your PR title ...'.
     3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][KYUUBI #XXXX] Your PR title ...'.
   -->
   
   ### _Why are the changes needed?_
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you add a feature, you can talk about the use case of it.
     2. If you fix a bug, you can clarify why it is a bug.
   -->
   
   
   ### _How was this patch tested?_
   - [X] Add some test cases that check the changes thoroughly including negative and positive cases if possible
   
   - [ ] Add screenshots for manual tests if appropriate
   
   - [X] [Run test](https://kyuubi.readthedocs.io/en/master/develop_tools/testing.html#running-tests) locally before make a pull request
   


-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] pan3793 commented on a diff in pull request #4751: [KYUUBI #4745] Support Flink's LocalZonedTimestamp DataType

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #4751:
URL: https://github.com/apache/kyuubi/pull/4751#discussion_r1174498152


##########
externals/kyuubi-flink-sql-engine/src/test/scala/org/apache/kyuubi/engine/flink/result/ResultSetSuite.scala:
##########
@@ -44,9 +46,9 @@ class ResultSetSuite extends KyuubiFunSuite {
       .data(rowsNew)
       .build
 
-    assert(RowSet.toRowBaseSet(rowsNew, resultSetNew)
-      === RowSet.toRowBaseSet(rowsOld, resultSetOld))
-    assert(RowSet.toColumnBasedSet(rowsNew, resultSetNew)
-      === RowSet.toColumnBasedSet(rowsOld, resultSetOld))
+    assert(RowSet.toRowBaseSet(rowsNew, resultSetNew, ZoneId.systemDefault())

Review Comment:
   `ZoneId.systemDefault()` may cause different results in different environments, let's use a specific one, e.g. `America/Los_Angeles`(PST) `Asia/Shanghai`(CST)



-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] pan3793 commented on a diff in pull request #4751: [KYUUBI #4745] Support Flink's LocalZonedTimestamp DataType

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #4751:
URL: https://github.com/apache/kyuubi/pull/4751#discussion_r1174497820


##########
externals/kyuubi-flink-sql-engine/src/main/scala/org/apache/kyuubi/engine/flink/schema/RowSet.scala:
##########
@@ -377,4 +398,23 @@ object RowSet {
         other.toString
     }
   }
+
+  /** should stay in sync with [[org.apache.hadoop.hive.common.type.TimestampTZUtil]] */
+  var TIMESTAMP_LZT_FORMATTER: DateTimeFormatter = {
+    val builder = new DateTimeFormatterBuilder()
+    // Date part
+    builder.append(DateTimeFormatter.ofPattern("uuuu-MM-dd"))
+    // Time part
+    builder.optionalStart().appendLiteral(" ").append(
+      DateTimeFormatter.ofPattern("HH:mm:ss")).optionalStart().appendFraction(
+      ChronoField.NANO_OF_SECOND,
+      1,
+      9,
+      true).optionalEnd().optionalEnd()
+    // Zone part
+    builder.optionalStart().appendLiteral(" ").optionalEnd()
+    builder.optionalStart().appendZoneOrOffsetId().optionalEnd()

Review Comment:
   if it's not intended, why add this?



-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] link3280 commented on a diff in pull request #4751: [KYUUBI #4745] Support Flink's LocalZonedTimestamp DataType

Posted by "link3280 (via GitHub)" <gi...@apache.org>.
link3280 commented on code in PR #4751:
URL: https://github.com/apache/kyuubi/pull/4751#discussion_r1174500668


##########
externals/kyuubi-flink-sql-engine/src/main/scala/org/apache/kyuubi/engine/flink/schema/RowSet.scala:
##########
@@ -377,4 +398,23 @@ object RowSet {
         other.toString
     }
   }
+
+  /** should stay in sync with [[org.apache.hadoop.hive.common.type.TimestampTZUtil]] */
+  var TIMESTAMP_LZT_FORMATTER: DateTimeFormatter = {
+    val builder = new DateTimeFormatterBuilder()
+    // Date part
+    builder.append(DateTimeFormatter.ofPattern("uuuu-MM-dd"))

Review Comment:
   The format is copied from TimestampTZUtil in `kyuubi-hive-jdbc` module. IIUC, `uuuu` has better compatibility with years before `1970`.



-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] link3280 commented on a diff in pull request #4751: [KYUUBI #4745] Support Flink's LocalZonedTimestamp DataType

Posted by "link3280 (via GitHub)" <gi...@apache.org>.
link3280 commented on code in PR #4751:
URL: https://github.com/apache/kyuubi/pull/4751#discussion_r1174377431


##########
externals/kyuubi-flink-sql-engine/src/test/scala/org/apache/kyuubi/engine/flink/operation/FlinkOperationSuite.scala:
##########
@@ -739,6 +739,23 @@ abstract class FlinkOperationSuite extends HiveJDBCTestHelper with WithFlinkTest
     }
   }
 
+  test("execute statement - select timestamp with local time zone") {
+    withJdbcStatement() { statement =>
+      statement.executeQuery("CREATE VIEW T1 AS SELECT TO_TIMESTAMP_LTZ(4001, 3)")
+      statement.executeQuery("SET 'table.local-time-zone' = 'UTC'")
+      val resultSetUTC = statement.executeQuery("SELECT * FROM T1")
+      val metaData = resultSetUTC.getMetaData
+      assert(metaData.getColumnType(1) === java.sql.Types.OTHER)
+      assert(resultSetUTC.next())
+      assert(resultSetUTC.getString(1) === "1970-01-01 00:00:04.001 UTC")

Review Comment:
   `TIMESTAMP WITH LOCAL ZONE` should not show the zone part. Something is wrong.



-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] link3280 commented on pull request #4751: [KYUUBI #4745] Support Flink's LocalZonedTimestamp DataType

Posted by "link3280 (via GitHub)" <gi...@apache.org>.
link3280 commented on PR #4751:
URL: https://github.com/apache/kyuubi/pull/4751#issuecomment-1521644045

   @pan3793 I started a thread to discuss the timestamp format issue https://www.mail-archive.com/dev@flink.apache.org/msg66257.html. But I don't think it's a blocker for this PR.


-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] pan3793 commented on a diff in pull request #4751: [KYUUBI #4745] Support Flink's LocalZonedTimestamp DataType

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #4751:
URL: https://github.com/apache/kyuubi/pull/4751#discussion_r1174497640


##########
externals/kyuubi-flink-sql-engine/src/main/scala/org/apache/kyuubi/engine/flink/schema/RowSet.scala:
##########
@@ -377,4 +398,23 @@ object RowSet {
         other.toString
     }
   }
+
+  /** should stay in sync with [[org.apache.hadoop.hive.common.type.TimestampTZUtil]] */
+  var TIMESTAMP_LZT_FORMATTER: DateTimeFormatter = {
+    val builder = new DateTimeFormatterBuilder()
+    // Date part
+    builder.append(DateTimeFormatter.ofPattern("uuuu-MM-dd"))

Review Comment:
   what does `uuuu-MM-dd` mean?



-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] link3280 commented on a diff in pull request #4751: [KYUUBI #4745] Support Flink's LocalZonedTimestamp DataType

Posted by "link3280 (via GitHub)" <gi...@apache.org>.
link3280 commented on code in PR #4751:
URL: https://github.com/apache/kyuubi/pull/4751#discussion_r1174499545


##########
externals/kyuubi-flink-sql-engine/src/main/scala/org/apache/kyuubi/engine/flink/schema/RowSet.scala:
##########
@@ -377,4 +398,23 @@ object RowSet {
         other.toString
     }
   }
+
+  /** should stay in sync with [[org.apache.hadoop.hive.common.type.TimestampTZUtil]] */
+  var TIMESTAMP_LZT_FORMATTER: DateTimeFormatter = {
+    val builder = new DateTimeFormatterBuilder()
+    // Date part
+    builder.append(DateTimeFormatter.ofPattern("uuuu-MM-dd"))
+    // Time part
+    builder.optionalStart().appendLiteral(" ").append(
+      DateTimeFormatter.ofPattern("HH:mm:ss")).optionalStart().appendFraction(
+      ChronoField.NANO_OF_SECOND,
+      1,
+      9,
+      true).optionalEnd().optionalEnd()
+    // Zone part
+    builder.optionalStart().appendLiteral(" ").optionalEnd()
+    builder.optionalStart().appendZoneOrOffsetId().optionalEnd()

Review Comment:
   Because parsing at JDBC requires the zone part, otherwise we would ran into this exception: https://github.com/apache/kyuubi/blob/06dd7d3754ee210f7744e46030965a6f5df1953b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/common/TimestampTZUtil.java#L84 



-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] link3280 commented on a diff in pull request #4751: [KYUUBI #4745] Support Flink's LocalZonedTimestamp DataType

Posted by "link3280 (via GitHub)" <gi...@apache.org>.
link3280 commented on code in PR #4751:
URL: https://github.com/apache/kyuubi/pull/4751#discussion_r1174499545


##########
externals/kyuubi-flink-sql-engine/src/main/scala/org/apache/kyuubi/engine/flink/schema/RowSet.scala:
##########
@@ -377,4 +398,23 @@ object RowSet {
         other.toString
     }
   }
+
+  /** should stay in sync with [[org.apache.hadoop.hive.common.type.TimestampTZUtil]] */
+  var TIMESTAMP_LZT_FORMATTER: DateTimeFormatter = {
+    val builder = new DateTimeFormatterBuilder()
+    // Date part
+    builder.append(DateTimeFormatter.ofPattern("uuuu-MM-dd"))
+    // Time part
+    builder.optionalStart().appendLiteral(" ").append(
+      DateTimeFormatter.ofPattern("HH:mm:ss")).optionalStart().appendFraction(
+      ChronoField.NANO_OF_SECOND,
+      1,
+      9,
+      true).optionalEnd().optionalEnd()
+    // Zone part
+    builder.optionalStart().appendLiteral(" ").optionalEnd()
+    builder.optionalStart().appendZoneOrOffsetId().optionalEnd()

Review Comment:
   Because parsing at JDBC requires the zone part, otherwise we would run into this exception: https://github.com/apache/kyuubi/blob/06dd7d3754ee210f7744e46030965a6f5df1953b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/common/TimestampTZUtil.java#L84 



-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] link3280 commented on a diff in pull request #4751: [KYUUBI #4745] Support Flink's LocalZonedTimestamp DataType

Posted by "link3280 (via GitHub)" <gi...@apache.org>.
link3280 commented on code in PR #4751:
URL: https://github.com/apache/kyuubi/pull/4751#discussion_r1174500668


##########
externals/kyuubi-flink-sql-engine/src/main/scala/org/apache/kyuubi/engine/flink/schema/RowSet.scala:
##########
@@ -377,4 +398,23 @@ object RowSet {
         other.toString
     }
   }
+
+  /** should stay in sync with [[org.apache.hadoop.hive.common.type.TimestampTZUtil]] */
+  var TIMESTAMP_LZT_FORMATTER: DateTimeFormatter = {
+    val builder = new DateTimeFormatterBuilder()
+    // Date part
+    builder.append(DateTimeFormatter.ofPattern("uuuu-MM-dd"))

Review Comment:
   The format is copied from TimestampTZUtil in `kyuubi-hive-jdbc` module. IIUC, `uuuu` has better compatibility with years before the era.



-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] codecov-commenter commented on pull request #4751: [KYUUBI #4745] Support Flink's LocalZonedTimestamp DataType

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #4751:
URL: https://github.com/apache/kyuubi/pull/4751#issuecomment-1518583324

   ## [Codecov](https://codecov.io/gh/apache/kyuubi/pull/4751?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#4751](https://codecov.io/gh/apache/kyuubi/pull/4751?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (5f9976d) into [master](https://codecov.io/gh/apache/kyuubi/commit/f6331a2a0fc0650ba0970d58f90a7a7c8e908095?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (f6331a2) will **decrease** coverage by `0.03%`.
   > The diff coverage is `n/a`.
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #4751      +/-   ##
   ============================================
   - Coverage     58.07%   58.04%   -0.03%     
     Complexity       13       13              
   ============================================
     Files           581      581              
     Lines         32297    32325      +28     
     Branches       4313     4308       -5     
   ============================================
   + Hits          18755    18762       +7     
   - Misses        11745    11758      +13     
   - Partials       1797     1805       +8     
   ```
   
   
   [see 22 files with indirect coverage changes](https://codecov.io/gh/apache/kyuubi/pull/4751/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] pan3793 commented on pull request #4751: [KYUUBI #4745] Support Flink's LocalZonedTimestamp DataType

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on PR #4751:
URL: https://github.com/apache/kyuubi/pull/4751#issuecomment-1521673121

   Thanks, merged to master


-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] pan3793 closed pull request #4751: [KYUUBI #4745] Support Flink's LocalZonedTimestamp DataType

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 closed pull request #4751: [KYUUBI #4745] Support Flink's LocalZonedTimestamp DataType
URL: https://github.com/apache/kyuubi/pull/4751


-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org