例: AvroContainerSplitの使用 - Teradata Database - Teradata Vantage NewSQL Engine - AvroContainerSplitの例。

Teradata Vantage™ DATASETデータ型

Product
Teradata Database
Teradata Vantage NewSQL Engine
Release Number
16.20
Published
2019年3月
Language
日本語
Last Update
2019-10-29
dita:mapPath
ja-JP/pgs1512082344257.ditamap
dita:ditavalPath
ja-JP/pgs1512082344257.ditaval
dita:id
B035-1198
Product Category
Software
Teradata Vantage

次の例では、Avroオブジェクト コンテナ内のファイルを表わすBLOBのテーブルにAvroContainerSplitを使用しています。

/* 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;