| <table class="table"> |
| <thead> |
| <tr> |
| <th style="width:25%">Function</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td>is_variant_null(expr)</td> |
| <td>Check if a variant value is a variant null. Returns true if and only if the input is a variant null and false otherwise (including in the case of SQL NULL).</td> |
| </tr> |
| <tr> |
| <td>parse_json(jsonStr)</td> |
| <td>Parse a JSON string as a Variant value. Throw an exception when the string is not valid JSON value.</td> |
| </tr> |
| <tr> |
| <td>schema_of_variant(v)</td> |
| <td>Returns schema in the SQL format of a variant.</td> |
| </tr> |
| <tr> |
| <td>schema_of_variant_agg(v)</td> |
| <td>Returns the merged schema in the SQL format of a variant column.</td> |
| </tr> |
| <tr> |
| <td>to_variant_object(expr)</td> |
| <td>Convert a nested input (array/map/struct) into a variant where maps and structs are converted to variant objects which are unordered unlike SQL structs. Input maps can only have string keys.</td> |
| </tr> |
| <tr> |
| <td>try_parse_json(jsonStr)</td> |
| <td>Parse a JSON string as a Variant value. Return NULL when the string is not valid JSON value.</td> |
| </tr> |
| <tr> |
| <td>try_variant_get(v, path[, type])</td> |
| <td>Extracts a sub-variant from `v` according to `path`, and then cast the sub-variant to `type`. When `type` is omitted, it is default to `variant`. Returns null if the path does not exist or the cast fails.</td> |
| </tr> |
| <tr> |
| <td>variant_explode(expr)</td> |
| <td>It separates a variant object/array into multiple rows containing its fields/elements. Its result schema is `struct<pos int, key string, value variant>`. `pos` is the position of the field/element in its parent object/array, and `value` is the field/element value. `key` is the field name when exploding a variant object, or is NULL when exploding a variant array. It ignores any input that is not a variant array/object, including SQL NULL, variant null, and any other variant values.</td> |
| </tr> |
| <tr> |
| <td>variant_explode_outer(expr)</td> |
| <td>It separates a variant object/array into multiple rows containing its fields/elements. Its result schema is `struct<pos int, key string, value variant>`. `pos` is the position of the field/element in its parent object/array, and `value` is the field/element value. `key` is the field name when exploding a variant object, or is NULL when exploding a variant array. It ignores any input that is not a variant array/object, including SQL NULL, variant null, and any other variant values.</td> |
| </tr> |
| <tr> |
| <td>variant_get(v, path[, type])</td> |
| <td>Extracts a sub-variant from `v` according to `path`, and then cast the sub-variant to `type`. When `type` is omitted, it is default to `variant`. Returns null if the path does not exist. Throws an exception if the cast fails.</td> |
| </tr> |
| </tbody> |
| </table> |