You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "xiaochen-zhou (via GitHub)" <gi...@apache.org> on 2025/02/14 21:03:48 UTC

[PR] [Fix][Zeta] Add DateMilliConvertor to Convert DateMilliVector into Default Timezone [seatunnel]

xiaochen-zhou opened a new pull request, #8736:
URL: https://github.com/apache/seatunnel/pull/8736

   <!--
   
   Thank you for contributing to SeaTunnel! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   ## Contribution Checklist
     - Make sure that the pull request corresponds to a [GITHUB issue](https://github.com/apache/seatunnel/issues).
     - Name the pull request in the form "[Feature] [component] Title of the pull request", where *Feature* can be replaced by `Hotfix`, `Bug`, etc.
     - Minor fixes should be named following this pattern: `[hotfix] [docs] Fix typo in README.md doc`.
   -->
   
   ### Purpose of this pull request
   
   <!-- Describe the purpose of this pull request. For example: This pull request adds checkstyle plugin.-->
   
   
   ### Does this PR introduce _any_ user-facing change?
   
   The DateMilliVector type in Apache Arrow stores timestamps in UTC,Add DateMilliConvertor to Convert DateMilliVector into Default Timezone.
   
   
   ### How was this patch tested?
   
   exist tests
   
   
   ### Check list
   
   * [ ] If any new Jar binary package adding in your PR, please add License Notice according
     [New License Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/contribution/new-license.md)
   * [ ] If necessary, please update the documentation to describe the new feature. https://github.com/apache/seatunnel/tree/dev/docs
   * [ ] If you are contributing the connector code, please check that the following files are updated:
     1. Update [plugin-mapping.properties](https://github.com/apache/seatunnel/blob/dev/plugin-mapping.properties) and add new connector information in it
     2. Update the pom file of [seatunnel-dist](https://github.com/apache/seatunnel/blob/dev/seatunnel-dist/pom.xml)
     3. Add ci label in [label-scope-conf](https://github.com/apache/seatunnel/blob/dev/.github/workflows/labeler/label-scope-conf.yml)
     4. Add e2e testcase in [seatunnel-e2e](https://github.com/apache/seatunnel/tree/dev/seatunnel-e2e/seatunnel-connector-v2-e2e/)
     5. Update connector [plugin_config](https://github.com/apache/seatunnel/blob/dev/config/plugin_config)
   * [ ] Update the [`release-note`](https://github.com/apache/seatunnel/blob/dev/release-note.md).


-- 
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: commits-unsubscribe@seatunnel.apache.org

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


Re: [PR] [Fix][Connector-v2] Add DateMilliConvertor to Convert DateMilliVector into Default Timezone [seatunnel]

Posted by "xiaochen-zhou (via GitHub)" <gi...@apache.org>.
xiaochen-zhou commented on PR #8736:
URL: https://github.com/apache/seatunnel/pull/8736#issuecomment-2661857052

   > Could you add a test case to cover it?
   
   There is already this test case: `ArrowToSeatunnelRowReaderTest#testSeatunnelRow()`. If this conversion is not added, it may cause this test case to fail, for example, before 8 a.m.


-- 
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: commits-unsubscribe@seatunnel.apache.org

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


Re: [PR] [Fix][Connector-v2] Add DateMilliConvertor to Convert DateMilliVector into Default Timezone [seatunnel]

Posted by "xiaochen-zhou (via GitHub)" <gi...@apache.org>.
xiaochen-zhou commented on PR #8736:
URL: https://github.com/apache/seatunnel/pull/8736#issuecomment-2661858354

   > Could you add a test case to cover it?
   
   Store Timestamp:1739564483396
   ![image](https://github.com/user-attachments/assets/50c2aa83-41a4-4e89-b2a3-6c3f50ed1a2e)
   
   ![image](https://github.com/user-attachments/assets/70d982a2-27c1-4fcc-9965-30addca6db2b)
   
   
   


-- 
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: commits-unsubscribe@seatunnel.apache.org

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


Re: [PR] [Fix][Connector-v2] Add DateMilliConvertor to Convert DateMilliVector into Default Timezone [seatunnel]

Posted by "xiaochen-zhou (via GitHub)" <gi...@apache.org>.
xiaochen-zhou commented on PR #8736:
URL: https://github.com/apache/seatunnel/pull/8736#issuecomment-2661875452

   > > Could you add a test case to cover it?
   > 
   > Store Timestamp:1739564483396 ![image](https://private-user-images.githubusercontent.com/27844885/413684022-50c2aa83-41a4-4e89-b2a3-6c3f50ed1a2e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk3NjIzOTAsIm5iZiI6MTczOTc2MjA5MCwicGF0aCI6Ii8yNzg0NDg4NS80MTM2ODQwMjItNTBjMmFhODMtNDFhNC00ZTg5LWIyYTMtNmMzZjUwZWQxYTJlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE3VDAzMTQ1MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTNkZjhiNDVjZmU3MGZmNjdjZmIxOWQ2MWRkYTA5NjA0NmY3MGNmOWRjMmYxN2FlNjM1MDQ5NjYzOTFiYzJiNDQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.tnIX2xbV47NpAT8xW7YIGr58QdX8dnoBJVy1V585dwA)
   > 
   > ![image](https://private-user-images.githubusercontent.com/27844885/413684050-70d982a2-27c1-4fcc-9965-30addca6db2b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk3NjIzOTAsIm5iZiI6MTczOTc2MjA5MCwicGF0aCI6Ii8yNzg0NDg4NS80MTM2ODQwNTAtNzBkOTgyYTItMjdjMS00ZmNjLTk5NjUtMzBhZGRjYTZkYjJiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE3VDAzMTQ1MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTllMzQxYzNlM2NlODA1MGRjM2YwZmFhOWIzZDk5MTQwMzg1ZTg5N2Y0NTc3OWVkNjhjMDJjNWU5MTQ3ZjgwNmQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.hjwACoWgJAMbQIKKtjXESDcICXJ_mpgrCvCYsHbj51M)
   
   @Hisoka-X 


-- 
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: commits-unsubscribe@seatunnel.apache.org

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


Re: [PR] [Fix][Connector-v2] Add DateMilliConvertor to Convert DateMilliVector into Default Timezone [seatunnel]

Posted by "Hisoka-X (via GitHub)" <gi...@apache.org>.
Hisoka-X commented on PR #8736:
URL: https://github.com/apache/seatunnel/pull/8736#issuecomment-2661888239

   > > > If this conversion is not added, it may cause this test case to fail, for example, before 8 a.m.
   > > 
   > > 
   > > Any test case failed link?
   > 
   > No, I discovered this during local debugging. This test case is likely to reproduce the issue if run before 8 a.m.
   
   OK, please add test case.


-- 
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: commits-unsubscribe@seatunnel.apache.org

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


Re: [PR] [Fix][Connector-v2] Add DateMilliConvertor to Convert DateMilliVector into Default Timezone [seatunnel]

Posted by "xiaochen-zhou (via GitHub)" <gi...@apache.org>.
xiaochen-zhou commented on PR #8736:
URL: https://github.com/apache/seatunnel/pull/8736#issuecomment-2664453096

   @Hisoka-X @hawk9821 done.


-- 
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: commits-unsubscribe@seatunnel.apache.org

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


Re: [PR] [Fix][Connector-v2] Add DateMilliConvertor to Convert DateMilliVector into Default Timezone [seatunnel]

Posted by "hawk9821 (via GitHub)" <gi...@apache.org>.
hawk9821 commented on code in PR #8736:
URL: https://github.com/apache/seatunnel/pull/8736#discussion_r1957728435


##########
seatunnel-connectors-v2/connector-common/src/test/java/org/apache/seatunnel/connectors/seatunnel/common/source/arrow/ArrowToSeatunnelRowReaderTest.java:
##########
@@ -212,19 +212,19 @@ private static VectorSchemaRoot buildVectorSchemaRoot(
                             ((VarCharVector) vector)
                                     .setSafe(i, (stringValue).getBytes(StandardCharsets.UTF_8));
                         } else if (vector instanceof TimeStampMicroVector) {
-                            ((TimeStampMicroVector) vector).setSafe(i, epochMilli * 1000);
+                            ((TimeStampMicroVector) vector).setSafe(i, testEpochMilli);

Review Comment:
   ```suggestion
                               ((TimeStampMicroVector) vector).setSafe(i, epochMilli * 1000);
   ```



##########
seatunnel-connectors-v2/connector-common/src/test/java/org/apache/seatunnel/connectors/seatunnel/common/source/arrow/ArrowToSeatunnelRowReaderTest.java:
##########
@@ -84,13 +85,18 @@ public class ArrowToSeatunnelRowReaderTest {
     private static RootAllocator rootAllocator;
     private static final List<SeaTunnelDataTypeHolder> seaTunnelDataTypeHolder = new ArrayList<>();
 
+    // 2025-02-15 04:21:23
+    private static long testEpochMilli = 1739564483396L;
     /**
      * LocalDateTime.now() is timestamped with a precision of nanoseconds on linux and milliseconds
      * on windows The test case uses TimeStampMicroVector to test the timestamp, thus truncating the
      * timestamp accuracy to ChronoUnit.MILLIS
      */
     private static final LocalDateTime localDateTime =

Review Comment:
   ```suggestion
       private static final LocalDateTime localDateTime =
               LocalDateTime.parse(
                       "2025-02-15 02:21:23", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
   ```



##########
seatunnel-connectors-v2/connector-common/src/test/java/org/apache/seatunnel/connectors/seatunnel/common/source/arrow/ArrowToSeatunnelRowReaderTest.java:
##########
@@ -212,19 +212,19 @@ private static VectorSchemaRoot buildVectorSchemaRoot(
                             ((VarCharVector) vector)
                                     .setSafe(i, (stringValue).getBytes(StandardCharsets.UTF_8));
                         } else if (vector instanceof TimeStampMicroVector) {
-                            ((TimeStampMicroVector) vector).setSafe(i, epochMilli * 1000);
+                            ((TimeStampMicroVector) vector).setSafe(i, testEpochMilli);
                         } else if (vector instanceof VarBinaryVector) {
                             ((VarBinaryVector) vector)
                                     .setSafe(i, (stringValue).getBytes(StandardCharsets.UTF_8));
                         } else if (vector instanceof LargeVarCharVector) {
                             ((LargeVarCharVector) vector)
                                     .setSafe(i, (stringValue).getBytes(StandardCharsets.UTF_8));
                         } else if (vector instanceof TimeStampMilliTZVector) {
-                            ((TimeStampMilliTZVector) vector).setSafe(i, epochMilli);
+                            ((TimeStampMilliTZVector) vector).setSafe(i, testEpochMilli);

Review Comment:
   ```suggestion
                               ((TimeStampMilliTZVector) vector).setSafe(i, epochMilli);
   ```



##########
seatunnel-connectors-v2/connector-common/src/test/java/org/apache/seatunnel/connectors/seatunnel/common/source/arrow/ArrowToSeatunnelRowReaderTest.java:
##########
@@ -212,19 +212,19 @@ private static VectorSchemaRoot buildVectorSchemaRoot(
                             ((VarCharVector) vector)
                                     .setSafe(i, (stringValue).getBytes(StandardCharsets.UTF_8));
                         } else if (vector instanceof TimeStampMicroVector) {
-                            ((TimeStampMicroVector) vector).setSafe(i, epochMilli * 1000);
+                            ((TimeStampMicroVector) vector).setSafe(i, testEpochMilli);
                         } else if (vector instanceof VarBinaryVector) {
                             ((VarBinaryVector) vector)
                                     .setSafe(i, (stringValue).getBytes(StandardCharsets.UTF_8));
                         } else if (vector instanceof LargeVarCharVector) {
                             ((LargeVarCharVector) vector)
                                     .setSafe(i, (stringValue).getBytes(StandardCharsets.UTF_8));
                         } else if (vector instanceof TimeStampMilliTZVector) {
-                            ((TimeStampMilliTZVector) vector).setSafe(i, epochMilli);
+                            ((TimeStampMilliTZVector) vector).setSafe(i, testEpochMilli);
                         } else if (vector instanceof TimeMicroVector) {
-                            ((TimeMicroVector) vector).setSafe(i, epochMilli);
+                            ((TimeMicroVector) vector).setSafe(i, testEpochMilli);

Review Comment:
   ditto



##########
seatunnel-connectors-v2/connector-common/src/test/java/org/apache/seatunnel/connectors/seatunnel/common/source/arrow/ArrowToSeatunnelRowReaderTest.java:
##########
@@ -212,19 +212,19 @@ private static VectorSchemaRoot buildVectorSchemaRoot(
                             ((VarCharVector) vector)
                                     .setSafe(i, (stringValue).getBytes(StandardCharsets.UTF_8));
                         } else if (vector instanceof TimeStampMicroVector) {
-                            ((TimeStampMicroVector) vector).setSafe(i, epochMilli * 1000);
+                            ((TimeStampMicroVector) vector).setSafe(i, testEpochMilli);
                         } else if (vector instanceof VarBinaryVector) {
                             ((VarBinaryVector) vector)
                                     .setSafe(i, (stringValue).getBytes(StandardCharsets.UTF_8));
                         } else if (vector instanceof LargeVarCharVector) {
                             ((LargeVarCharVector) vector)
                                     .setSafe(i, (stringValue).getBytes(StandardCharsets.UTF_8));
                         } else if (vector instanceof TimeStampMilliTZVector) {
-                            ((TimeStampMilliTZVector) vector).setSafe(i, epochMilli);
+                            ((TimeStampMilliTZVector) vector).setSafe(i, testEpochMilli);
                         } else if (vector instanceof TimeMicroVector) {
-                            ((TimeMicroVector) vector).setSafe(i, epochMilli);
+                            ((TimeMicroVector) vector).setSafe(i, testEpochMilli);
                         } else if (vector instanceof DateMilliVector) {
-                            ((DateMilliVector) vector).setSafe(i, epochMilli);
+                            ((DateMilliVector) vector).setSafe(i, testEpochMilli);

Review Comment:
   ditto



##########
seatunnel-connectors-v2/connector-common/src/test/java/org/apache/seatunnel/connectors/seatunnel/common/source/arrow/ArrowToSeatunnelRowReaderTest.java:
##########
@@ -172,13 +178,7 @@ private static VectorSchemaRoot buildVectorSchemaRoot(
         }
         // allocate storage
         vectors.forEach(FieldVector::allocateNew);

Review Comment:
   ```suggestion
           vectors.forEach(FieldVector::allocateNew);
           long epochMilli = localDateTime.atZone(zoneId).toInstant().toEpochMilli();
   ```



##########
seatunnel-connectors-v2/connector-common/src/test/java/org/apache/seatunnel/connectors/seatunnel/common/source/arrow/ArrowToSeatunnelRowReaderTest.java:
##########
@@ -257,7 +257,7 @@ private static VectorSchemaRoot buildVectorSchemaRoot(
                                 if ("array2".equals(name)) {
                                     List<LocalDateTime> dateTimeList = new ArrayList<>();
                                     for (int j = 0; j < 5; j++) {
-                                        writer.writeTimeStampMilliTZ(epochMilli);
+                                        writer.writeTimeStampMilliTZ(testEpochMilli);

Review Comment:
   ditto



-- 
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: commits-unsubscribe@seatunnel.apache.org

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


Re: [PR] [Fix][Connector-v2] Add DateMilliConvertor to Convert DateMilliVector into Default Timezone [seatunnel]

Posted by "xiaochen-zhou (via GitHub)" <gi...@apache.org>.
xiaochen-zhou commented on PR #8736:
URL: https://github.com/apache/seatunnel/pull/8736#issuecomment-2661911723

   > > > Could you add a test case to cover it?
   > > 
   > > 
   > > There is already this test case: `ArrowToSeatunnelRowReaderTest#testSeatunnelRow()`. If this conversion is not added, it may cause this test case to fail, for example, before 8 a.m.
   > 
   > I think we can use a fixed datetime (not use system time now()) to reproduce this bug.
   
   Ok, I will refer to this to add the test case. @Hisoka-X 
   
   
   
   


-- 
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: commits-unsubscribe@seatunnel.apache.org

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


Re: [PR] [Fix][Connector-v2] Add DateMilliConvertor to Convert DateMilliVector into Default Timezone [seatunnel]

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


-- 
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: commits-unsubscribe@seatunnel.apache.org

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


Re: [PR] [Fix][Connector-v2] Add DateMilliConvertor to Convert DateMilliVector into Default Timezone [seatunnel]

Posted by "Hisoka-X (via GitHub)" <gi...@apache.org>.
Hisoka-X commented on PR #8736:
URL: https://github.com/apache/seatunnel/pull/8736#issuecomment-2661863734

   > > Could you add a test case to cover it?
   > 
   > There is already this test case: `ArrowToSeatunnelRowReaderTest#testSeatunnelRow()`. If this conversion is not added, it may cause this test case to fail, for example, before 8 a.m.
   
   I think we can use a fixed datetime (not use system time now()) to reproduce this bug.


-- 
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: commits-unsubscribe@seatunnel.apache.org

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


Re: [PR] [Fix][Connector-v2] Add DateMilliConvertor to Convert DateMilliVector into Default Timezone [seatunnel]

Posted by "Hisoka-X (via GitHub)" <gi...@apache.org>.
Hisoka-X commented on PR #8736:
URL: https://github.com/apache/seatunnel/pull/8736#issuecomment-2661865058

   > If this conversion is not added, it may cause this test case to fail, for example, before 8 a.m.
   
   Any test case failed link? 


-- 
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: commits-unsubscribe@seatunnel.apache.org

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


Re: [PR] [Fix][Connector-v2] Add DateMilliConvertor to Convert DateMilliVector into Default Timezone [seatunnel]

Posted by "xiaochen-zhou (via GitHub)" <gi...@apache.org>.
xiaochen-zhou commented on PR #8736:
URL: https://github.com/apache/seatunnel/pull/8736#issuecomment-2661875201

   > > If this conversion is not added, it may cause this test case to fail, for example, before 8 a.m.
   > 
   > Any test case failed link?
   
   No, I discovered this during local debugging. This test case is likely to reproduce the issue if run before 8 a.m.
   
   
   
   


-- 
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: commits-unsubscribe@seatunnel.apache.org

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