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.

Note: 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.

Parameters

flatten_arrays
BOOLEAN

[Optional] Flattens all Avro arrays. Key names are concatenated with nested levels.

Default value: false (Arrays are not flattened.)

flatten_maps
BOOLEAN

[Optional] Flattens all Avro maps. Key names are concatenated with nested levels.

Default value: true

flatten_records
BOOLEAN

[Optional] Flattens all Avro records. Key names are concatenated with nested levels.

Default value: true

reject_on_materialized_type_error
BOOLEAN

[Optional] Indicates 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 value: 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