FAVROPARSER (Parser)

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.

If the Avro data contains complex types (arrays, structs, or maps), you can load those columns into VMap columns in columnar tables. Specify a column type of LONG VARBINARY for these columns.

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.

=> CREATE FLEX TABLE avro_basic();
CREATE TABLE
				
=> COPY avro_basic FROM '/home/dbadmin/data/weather.avro' PARSER FAVROPARSER();
Rows Loaded
-------------
5
(1 row)

=> 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.