Mapping Between Teradata Data Types and R | Teradata Vantage - Mapping Between Teradata Data Types and R Types - Analytics Database - Teradata Vantage

SQL External Routine Programming

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2023-07-11
dita:mapPath
iiv1628111441820.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
B035-1147
lifecycle
latest
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