Mapping Between Teradata Data Types and R | Teradata Vantage - Mapping Between Teradata Data Types and R Types - Advanced SQL Engine - Teradata Database

SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-24
dita:mapPath
qwr1571437338192.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1147
lifecycle
previous
Product Category
Teradata Vantage™

The following table shows the mapping from Teradata attribute types into R types. This mapping is used by the tdr.GetAttributeByNdx and tdr.SetAttributeByNdx functions to convert an attribute value and type from its Teradata (or C) representation into its R representation and vice versa.

Teradata Data Types R
  • CHAR
  • VARCHAR
Character vector
  • BYTE
  • VARBYTE
Raw vector
  • BYTEINT
  • SMALLINT
  • INTEGER
Integer
  • BIGINT
  • REAL
  • DECIMAL1, DECIMAL2, DECIMAL4
Real
DECIMAL8, DECIMAL16 Raw vector
DATE Date (number of days since 1/1/1970)
TIME List with 3 elements:
  • seconds (Real unit vector)
  • hour (Integer unit vector)
  • minutes (Integer unit vector)

These three elements are the members of the C structure used to represent the TIME data type.

  • TIME_WTZ
  • TIMESTAMP
  • TIMESTAMP_WTZ
List with elements in the C structure used to represent the type in Teradata. The types of elements follow the mapping in Mapping Between R and C Data Types.
  • INTERVAL_YEAR
  • INTERVAL_MONTH
  • INTERVAL_DAY
  • INTERVAL_HOUR
  • INTERVAL_MINUTE
Integer
  • INTERVAL_YTM
  • INTERVALH
  • INTERVALM
  • INTERVALS
  • INTERVAL_HTM
  • INTERVAL_HTS
  • INTERVAL_MTS
  • INTERVAL_SECOND
List with elements in the C structure used to represent the type in Teradata. The types of elements follow the mapping in Mapping Between R and C Data Types.
  • BLOB_REFERENCE
  • CLOB_REFERENCE
Raw vector
This mapping was defined based on the following criteria:
  • The R data types are available in all R environments
  • The data conversion is lossless

The selected R types are part of the basic R and not specific packages that need to be installed. You can convert the returned data to the representation used by a package of your choice.

The XML and JSON data types are treated as LOBs.

The following data types are not supported:
  • ARRAY
  • Geospatial
  • NUMBER
  • Period
  • UDT