matriv commented on code in PR #19302:
URL: https://github.com/apache/flink/pull/19302#discussion_r842739630


##########
flink-connectors/flink-connector-elasticsearch-base/src/test/java/org/apache/flink/connector/elasticsearch/table/IndexGeneratorTest.java:
##########
@@ -86,6 +91,10 @@
                                     LocalDateTime.of(2020, 3, 18, 12, 12, 14, 
1000)),
                             (int) LocalDate.of(2020, 3, 18).toEpochDay(),
                             (int) (LocalTime.of(12, 13, 14, 
2000).toNanoOfDay() / 1_000_000L),
+                            TimestampData.fromInstant(
+                                    LocalDateTime.of(2020, 3, 18, 12, 12, 14, 
1000)

Review Comment:
   nit: I would use an hour close to `0` like `3`, so that the resulting index 
name, translates to a previous day  (17 instead of 18)



##########
flink-connectors/flink-connector-elasticsearch-base/src/test/java/org/apache/flink/connector/elasticsearch/table/IndexGeneratorTest.java:
##########
@@ -101,9 +110,44 @@
                                     LocalDateTime.of(2020, 3, 19, 12, 22, 14, 
1000)),
                             (int) LocalDate.of(2020, 3, 19).toEpochDay(),
                             (int) (LocalTime.of(12, 13, 14, 
2000).toNanoOfDay() / 1_000_000L),
+                            TimestampData.fromInstant(
+                                    LocalDateTime.of(2020, 3, 19, 12, 22, 14, 
1000)
+                                            .atZone(ZoneId.of("Asia/Shanghai"))

Review Comment:
   nit: I would use another timezone here, maybe `America/Los_Angeles` which 
has a `-` offset from UTC.
   Maybe also use an our > 12 closer to 24, like `20` to have a resulting date 
that "jumps ahead" (20/3 instead of 19/3).



##########
flink-connectors/flink-connector-elasticsearch-base/src/test/java/org/apache/flink/streaming/connectors/elasticsearch/table/IndexGeneratorFactoryTest.java:
##########
@@ -81,7 +87,10 @@ public void prepareData() {
                         (int) LocalDate.parse("2020-03-19").toEpochDay(),
                         (int) (LocalTime.parse("12:22:21").toNanoOfDay() / 
1_000_000L),
                         
TimestampData.fromLocalDateTime(LocalDateTime.parse("2020-03-19T12:22:14")),
-                        
TimestampData.fromInstant(Instant.parse("2020-03-19T12:12:14Z")),
+                        TimestampData.fromInstant(
+                                LocalDateTime.of(2020, 3, 19, 12, 22, 14, 1000)
+                                        .atZone(ZoneId.of("Asia/Shanghai"))

Review Comment:
   and here.



##########
flink-connectors/flink-connector-elasticsearch-base/src/test/java/org/apache/flink/connector/elasticsearch/table/IndexGeneratorTest.java:
##########
@@ -101,9 +110,44 @@
                                     LocalDateTime.of(2020, 3, 19, 12, 22, 14, 
1000)),
                             (int) LocalDate.of(2020, 3, 19).toEpochDay(),
                             (int) (LocalTime.of(12, 13, 14, 
2000).toNanoOfDay() / 1_000_000L),
+                            TimestampData.fromInstant(
+                                    LocalDateTime.of(2020, 3, 19, 12, 22, 14, 
1000)
+                                            .atZone(ZoneId.of("Asia/Shanghai"))
+                                            .toInstant()),
                             "test2",
                             false));
 
+    @Test
+    public void testDynamicIndexFromTimestampTzUTC() {
+        assumingThat(

Review Comment:
   nice!



##########
flink-connectors/flink-connector-elasticsearch-base/src/test/java/org/apache/flink/streaming/connectors/elasticsearch/table/IndexGeneratorFactoryTest.java:
##########
@@ -71,7 +74,10 @@ public void prepareData() {
                         (int) LocalDate.parse("2020-03-18").toEpochDay(),
                         (int) (LocalTime.parse("12:12:14").toNanoOfDay() / 
1_000_000L),
                         
TimestampData.fromLocalDateTime(LocalDateTime.parse("2020-03-18T12:12:14")),
-                        
TimestampData.fromInstant(Instant.parse("2020-03-18T12:12:14Z")),
+                        TimestampData.fromInstant(
+                                LocalDateTime.of(2020, 3, 18, 12, 12, 14, 1000)

Review Comment:
   Same comment here.



##########
flink-connectors/flink-connector-elasticsearch-base/src/test/java/org/apache/flink/streaming/connectors/elasticsearch/table/IndexGeneratorFactoryTest.java:
##########
@@ -193,12 +202,26 @@ public void testDynamicIndexFromSystemTime() {
     }
 
     @Test
-    public void testDynamicIndexDefaultFormatTimestampWithLocalTimeZone() {
+    public void testDynamicIndexDefaultFormatTimestampWithLocalTimeZoneUTC() {
+        assumeThat(ZoneId.systemDefault(), is(ZoneId.of("UTC")));

Review Comment:
   Why not use the same scheme with `assumingThat` as here: 
https://github.com/apache/flink/pull/19302/files#diff-718dd4539a392ce4b768bdfcabeca730bcdb4ffa4d09f691fd14c09002a84b95R124
 ?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to