FAVROPARSER

Parses data from an Avro file. The input file must use binary serialization encoding. Use this parser to load data into columnar, flex, and hybrid tables.

The parser favroparser does not support Avro files with separate schema files. The Avro file must have its related schema in the file you are loading.

Syntax

FAVROPARSER ( [parameter‑name='value'[,…]] )

Parameters

flatten_arrays

Boolean, specifies whether to flatten all Avro arrays. Key names are concatenated with nested levels.

Default: false

flatten_maps

Boolean, specifies whether to flatten all Avro maps. Key names are concatenated with nested levels.

Default:true

flatten_records

Boolean, specifies whether to flatten all Avro records. Key names are concatenated with nested levels.

Default:true

reject_on_materialized_type_error

Boolean, specifies whether to reject any row value for a materialized column that the parser cannot coerce into a compatible data type. See Using Flex Table Parsers.

Default:false

Examples

This example shows how to create and load a flex table with Avro data using favroparser. After loading the data, you can query virtual columns.

  1. Create a flex table for Avro data, avro_basic:

    => CREATE FLEX TABLE avro_basic();
    CREATE TABLE
  2. Use the favroparser to load the data from an Avro file (weather.avro).

    => COPY avro_basic FROM '/home/dbadmin/data/flexcsv/weather.avro' PARSER favroparser();
    Rows Loaded
    -------------
    5
    (1 row)
  3. Query virtual columns from the avro flex table:

    => SELECT station, temp, time FROM avro_basic;
    station | temp |     time
    ---------+------+---------------
    mohali  | 0    | -619524000000
    lucknow | 22   | -619506000000
    norwich | -11  | -619484400000
    ams     | 111  | -655531200000
    baddi   | 78   | -655509600000
    (5 rows)

    For more information, see Loading Avro Data.

    See Also