raminqaf commented on code in PR #29073:
URL: https://github.com/apache/flink/pull/29073#discussion_r3924818776


##########
docs/content.zh/docs/sql/reference/data-types.md:
##########
@@ -1588,6 +1588,33 @@ rendering. Use `JSON_STRING` for the JSON representation 
instead, where a string
 `"foo"` and an object or array is serialized. A variant that stores a JSON 
`null` casts to SQL
 `NULL`.
 
+A `VARIANT` can also be cast to a constructed target, which imposes a schema 
on it. A variant array
+casts to `ARRAY<T>`. The variant must be an array, otherwise the cast fails. 
Each element is itself a
+`VARIANT`, so it casts to the element type `T` by the same rules, recursively, 
bottoming out at the
+scalar cast above. A leaf is never parsed either, so a stored string does not 
reach an integer
+target. Cast the leaf to `STRING` first and convert with a regular cast.
+
+- Each element casts to `T`. A JSON null element maps to SQL `NULL` when `T` 
is nullable and fails
+  the cast when `T` is `NOT NULL`. An empty array casts to an empty `ARRAY<T>`.
+- `ARRAY<VARIANT>` is the identity leaf: it shreds one level and keeps each 
element as a variant. A

Review Comment:
   Addressed



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