VasShabu commented on code in PR #28850:
URL: https://github.com/apache/flink/pull/28850#discussion_r3705569265


##########
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/functions/SqlJsonUtils.java:
##########
@@ -446,6 +459,107 @@ private static Object dejsonize(String input) {
         return JSON_PATH_JSON_PROVIDER.parse(input);
     }
 
+    /**
+     * Returns an upper-case flag describing the type of the parsed JSON 
value, mirroring Calcite's
+     * {@code JsonFunctions.jsonType}.
+     *
+     * <p>JSON's grammar cannot express a date, and it has a single number 
rule with no width, so
+     * {@code DATE} and {@code FLOAT} cannot be read off the Java type the 
parser produces: a date
+     * arrives as a {@link String}, and every non-integral number arrives as a 
{@link BigDecimal}
+     * (the shared mapper enables {@code USE_BIG_DECIMAL_FOR_FLOATS}). Both 
flags are therefore
+     * inferred from the value itself, which is a deliberate Flink extension 
beyond Calcite:
+     *
+     * <ul>
+     *   <li>{@code DATE} for a string that is exactly a {@code yyyy-MM-dd} 
calendar date, e.g.
+     *       {@code "2015-01-01"}, which is the form the JSON format uses to 
read a {@code DATE}
+     *       column. Nothing else counts. This is stricter than {@code CAST(x 
AS DATE)}, which also
+     *       coerces {@code 2015-1-1}, {@code 2015-01} and {@code 2015}; those 
are
+     *       recognition-unsafe here, since {@code "2015"} is a perfectly 
ordinary string.
+     *       Date-times stay {@code STRING} in every spelling: there is no 
timestamp flag to return,
+     *       and answering {@code DATE} for a value carrying a time of day 
would be worse than
+     *       saying nothing. Flink has no single date-time spelling to defer 
to either — {@code
+     *       CAST}/{@code TO_TIMESTAMP} accept only a space separator, the 
JSON format accepts a

Review Comment:
   this para has been cuz because i have dropped the date type



-- 
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