fsk119 commented on a change in pull request #12661:
URL: https://github.com/apache/flink/pull/12661#discussion_r441315908



##########
File path: 
flink-formats/flink-json/src/main/java/org/apache/flink/formats/json/JsonOptions.java
##########
@@ -38,4 +44,40 @@
                        .defaultValue(false)
                        .withDescription("Optional flag to skip fields and rows 
with parse errors instead of failing;\n"
                                        + "fields are set to null in case of 
errors, false by default");
+
+       public static final ConfigOption<String> TIMESTAMP_FORMAT = 
ConfigOptions
+                       .key("timestamp-format.standard")
+                       .stringType()
+                       .defaultValue("SQL")
+                       .withDescription("Optional flag to specify timestamp 
format, SQL by default." +
+                               " Option ISO-8601 will parse input timestamp in 
\"yyyy-MM-ddTHH:mm:ss.s{precision}\" format and output timestamp in the same 
format." +
+                               " Option SQL will parse input timestamp in 
\"yyyy-MM-dd HH:mm:ss.s{precision}\" format and output timestamp in the same 
format.");
+
+       // 
--------------------------------------------------------------------------------------------
+       // Option enumerations
+       // 
--------------------------------------------------------------------------------------------
+
+       public static final String SQL = "SQL";
+       public static final String ISO_8601 = "ISO-8601";
+
+       public static final Set<String> TIMESTAMP_FORMAT_ENUM = new 
HashSet<>(Arrays.asList(
+               SQL,
+               ISO_8601
+       ));
+
+       // 
--------------------------------------------------------------------------------------------
+       // Utilities
+       // 
--------------------------------------------------------------------------------------------
+
+       public static TimestampFormat getTimestampFormat(ReadableConfig config){
+               String timestampFormat = config.get(TIMESTAMP_FORMAT);
+               switch (timestampFormat){
+                       case SQL:
+                               return TimestampFormat.SQL;
+                       case ISO_8601:
+                               return TimestampFormat.ISO_8601;
+               }
+               throw new TableException(

Review comment:
       OK. I have fixed it.




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to