Example: Using AvroContainerSplit - Analytics Database - Teradata Vantage

DATASET Data Type

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
ft:locale
en-US
ft:lastEdition
2023-10-30
dita:mapPath
bka1628112240653.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
ekk1458586304878
lifecycle
latest
Product Category
Teradata Vantageā„¢

The following example uses AvroContainerSplit on a table of BLOBs representing files in the Avro Object Container File format.

/* Create a table that contains the container objects */
CREATE TABLE containers(id INTEGER, container BLOB);

/* Load one or more containers into the containers table via
   the utility of your choice. */

/* Create a table that will receive the individual Avro objects
   from the AvroContainerSplit table operator. */
CREATE TABLE avro_table(
    container_id INTEGER,
    avro_id      INTEGER,
    avro_val     DATASET(8000) STORAGE FORMAT AVRO);

/* Invoke the table operator to split up the container. */
INSERT INTO avro_table
SELECT T.out_container_id, T.avro_object_id, T.avro_value
FROM AvroContainerSplit (ON (SELECT id, container FROM containers)) T;

/* Select out the individual Avro values in the JSON format. */
SELECT container_id, avro_id, avro_val.ToJson()
FROM avro_table
ORDER BY container_id, avro_id;