Example: Aggregating CSV_TO_AVRO Output - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

Aggregate output into one Avro array composed of Avro records mapping to each record of the CSV data.

SELECT data.toJSON() FROM CSV_TO_AVRO
 (
	ON (SELECT csvFile FROM myCSVTable09 WHERE id=2)
	USING SCHEMA('{"record_delimiter":"#"}')DO_AGGREGATE('Y')
) AS csvAvro;

Result:

> [{"Item_ID":"55", "Item_Name":"bicycle", "Item_Color":"red", "Item_Style":"boys", "Quantity_Purchased":"1", "Item_Price":"100.00", "Total_Price":"100.00"}, {"Item_ID":"88", "Item_Name":"toy boat", "Item_Color":"pink", "Item_Style":null, "Quantity_Purchased":"1", "Item_Price":"15.10", "Total_Price":"15.10"}, {"Item_ID":"105", "Item_Name":"soap", "Item_Color":null, "Item_Style":null, "Quantity_Purchased":"1", "Item_Price":"0.99", "Total_Price":"0.99"}]