hackergin commented on a change in pull request #18058:
URL: https://github.com/apache/flink/pull/18058#discussion_r771649822



##########
File path: 
flink-connectors/flink-connector-elasticsearch-base/src/main/java/org/apache/flink/connector/elasticsearch/table/IndexGeneratorFactory.java
##########
@@ -88,6 +89,21 @@ private static IndexGenerator createRuntimeIndexGenerator(
                 index.substring(indexPrefix.length() + 
dynamicIndexPatternStr.length());
 
         final boolean isDynamicIndexWithFormat = 
indexHelper.checkIsDynamicIndexWithFormat(index);
+        final boolean isDynamicIndexWithProcTimeFormat =
+                indexHelper.checkIsDynamicIndexWithProcTimeFormat(index);
+
+        if (isDynamicIndexWithProcTimeFormat) {
+            final String dateTimeFormat =
+                    indexHelper.extractDateFormat(
+                            index, 
LogicalTypeRoot.TIMESTAMP_WITHOUT_TIME_ZONE);
+            return new AbstractTimeIndexGenerator(index, dateTimeFormat) {
+                @Override
+                public String generate(RowData row) {
+                    return 
indexPrefix.concat(LocalDateTime.now().format(dateTimeFormatter));

Review comment:
       The return type of now() should be  TIMESTAMP_WITH_LTZ,  The 
LocalDate.now() will use jvm timezone.  To avoid misunderstandingļ¼Œ We should 
keep the same behavior.    But I'm not sure we can get the session timezone 
from connector? 




-- 
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-unsubscr...@flink.apache.org

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


Reply via email to