avro¶
This feature requires jaqy-avro
plugin.
Options¶
-c,--compression <arg> sets the compression codec
Note
- Supported compression can be seen at
CodecFactory
- null
- deflate
- snappy
- bzip2
- xz
Database Type to AVRO Type Mapping¶
Database Type | AVRO Type |
---|---|
BOOLEAN | BOOLEAN |
TINYINT SMALLINT INTEGER | INTEGER |
BIGINT | LONG |
FLOAT | FLOAT |
DOUBLE | DOUBLE |
ARRAY | ARRAY |
BINARY VARBINARY LONGVARBINARY BLOB | BYTES |
DECIMAL NUMERIC REAL CHAR VARCHAR CLOB | STRING |
Note
DECIMAL is converted to string to preserve the precision.
Array is in general treated as array of string types. The primary reason is that there is no way to get the array element type in JDBC.
- For PostgreSQL, because such information can be easily guessed, it is supported for some well known types.
Struct is exported as array of string types.
- For Teradata, PERIOD data types, which are transmitted as Struct types, are converted into formats that matches their BTEQ output formats.
- For PostgreSQL, the driver reports Struct type even though the data is actually string. Jaqy had a specific workaround for this inconsistency.
For types not listed in the above table, they are stored as STRING. AVRO exporter relies on the toString() function of the object retrieved by the JDBC driver to obtain the output. There is no guarantee such String representations can be used for import.
Example¶
.export avro myfile.avro
SELECT * FROM MyTable ORDER BY a;