Pack Example 1: Default Values - Teradata Vantage

Teradata® Vantage Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
1.0
8.00
Published
May 2019
Language
English (United States)
Last Update
2019-11-22
dita:mapPath
blj1506016597986.ditamap
dita:ditavalPath
blj1506016597986.ditaval
dita:id
lmf1502735330121
Product Category
Teradata Vantage

Input

The input table, ville_temperature, contains temperature readings for the cities Nashville and Knoxville, in the state of Tennessee.

ville_temperature
sn city state period temp_f
1 Nashville Tennessee 2010-01-01 00:00:00 35.1
2 Nashville Tennessee 2010-01-01 01:00:00 36.2
3 Nashville Tennessee 2010-01-01 02:00:00 34.5
4 Nashville Tennessee 2010-01-01 03:00:00 33.6
5 Nashville Tennessee 2010-01-01 04:00:00 33.1
6 Knoxville Tennessee 2010-01-01 03:00:00 33.2
7 Knoxville Tennessee 2010-01-01 04:00:00 32.8
8 Knoxville Tennessee 2010-01-01 05:00:00 32.4
9 Knoxville Tennessee 2010-01-01 06:00:00 32.2
10 Knoxville Tennessee 2010-01-01 07:00:00 32.4

SQL Call

Delimiter and IncludeColumnName have their default values.

SELECT * FROM Pack (
  ON ville_temperature
  USING
  Delimiter (',')
  OutputColumn ('packed_data')
  IncludeColumnName ('true')
  InputColumns ('city', 'state', 'period', 'temp_f')
) AS dt ORDER BY 2;

Output

The columns specified by InputColumns are packed in the column packed_data. Virtual columns are separated by commas, and each virtual column value is labeled with its column name. The input column sn, which was not specified by InputColumns, is unchanged in the output table.

packed_data sn
city:Nashville,state:Tennessee,period:2010-01-01 00:00:00,temp_f:35.1 1
city:Nashville,state:Tennessee,period:2010-01-01 01:00:00,temp_f:36.2 2
city:Nashville,state:Tennessee,period:2010-01-01 02:00:00,temp_f:34.5 3
city:Nashville,state:Tennessee,period:2010-01-01 03:00:00,temp_f:33.6 4
city:Nashville,state:Tennessee,period:2010-01-01 04:00:00,temp_f:33.1 5
city:Knoxville,state:Tennessee,period:2010-01-01 03:00:00,temp_f:33.2 6
city:Knoxville,state:Tennessee,period:2010-01-01 04:00:00,temp_f:32.8 7
city:Knoxville,state:Tennessee,period:2010-01-01 05:00:00,temp_f:32.4 8
city:Knoxville,state:Tennessee,period:2010-01-01 06:00:00,temp_f:32.2 9
city:Knoxville,state:Tennessee,period:2010-01-01 07:00:00,temp_f:32.4 10