schema_of_avro functie

Van toepassing op:ja aangevinkt Databricks SQL ja aangevinkt Databricks Runtime 17.0 en hoger

Geeft het schema van een Avro-schema in JSON-formaat terug als een DDL-geformatteerde string.

Syntax

schema_of_avro(jsonFormatSchema [, options] )

Arguments

  • jsonFormatSchema: Een constante STRING expressie die een Avro-schema in JSON-formaat bevat.
  • options: Een optionele constante MAP<STRING, STRING> expressie met conversieopties.

Returns

A STRING met het equivalente SQL-schema in DDL-formaat.

Opties

Zie Avro voor een volledige lijst met opties.

Examples

Leid het SQL-schema af voor een Avro-record dat een unie bevat:

> SELECT schema_of_avro(
    '{"type":"record","name":"struct","fields":[{"name":"u","type":["int","string"]}]}');
  STRUCT<u: STRUCT<member0: INT, member1: STRING> NOT NULL>