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

Teradata Vantageā„¢ - SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1147-171K
Language
English (United States)

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