適用於:
Databricks SQL
Databricks Runtime 17.0 及以上版本
以 DDL 格式的字串回傳 Avro 架構的 JSON 格式結構。
Syntax
schema_of_avro(jsonFormatSchema [, options] )
Arguments
-
jsonFormatSchema: 一個包含 JSON 格式 Avro 架構的常數STRING表達式。 -
options:一個包含轉換選項的可選常數MAP<STRING, STRING>表達式。
Returns
STRING A 包含等效的 DDL 格式 SQL 架構。
選項
完整選項清單請參見 Avro。
Examples
推導包含 union 的 Avro 記錄的 SQL 架構:
> SELECT schema_of_avro(
'{"type":"record","name":"struct","fields":[{"name":"u","type":["int","string"]}]}');
STRUCT<u: STRUCT<member0: INT, member1: STRING> NOT NULL>