7.00.02.01 - Data Type Mapping - Aster R

Teradata Aster® R User GuideUpdate 3

prodname
Aster R
vrm_release
7.00.02.01
created_date
December 2017
category
Programming Reference
User Guide
featnum
B700-1033-700K

This section lists the data type mapping between the Aster Database, ODBC, RODBC, Teradata Aster R (ta.data.frame), R, and STREAM (ta.apply and ta.tapply).

Data Type Mapping between Aster Database, ODBC, RODBC, Aster R, R, and STREAM
Aster ODBC RODBC Aster R

ta.data.frame

R STREAM

ta.apply

ta.tapply

Notes
smallint SQL_SMALLINT / 5 "smallint" "smallint" "integer" "integer"  
integer SQL_INTEGER / 4 "int" "int" "integer" "integer" In R, -2147483648 encoding stores the integer as NA.

-2147483648 is converted to NA (integer) through RODBC.

-2147483648 is converted to -2147483648 (numeric) through ta.pull.

-2147483648 is converted to -2147483648 (numeric) through STREAM Rexec.

bigint SQL_BIGINT / -5 "unknown" "bigint" "numeric" "numeric" Converted to numeric through RODBC.
real SQL_REAL / 7 "real" "real" "double" "double"  
double precision SQL_FLOAT / 6 "float" "float" “double" "double" There are differences in precision between RODBC, ta.pull and STREAM Rexec:

Fifteen digits of precision in RODBC and ta.pull.

Sixteen digits of precision in STREAM Rexec.

numeric [p[, s]] SQL_NUMERIC / 2

SQL_DOUBLE / 8 (NumericAndDecimalAsDouble = 1)

"numeric"

"double"

"numeric"

"double"

"numeric"

"double"

"numeric" The "numeric" in R is not a precise data type.
boolean SQL_BIT / -7 "unknown" "boolean" "integer" "logical" (for AD 6.10 and later releases)

"character"

The Aster boolean values are:

converted to 1 or 0 (numeric) through RODBC.

converted to 1 or 0 in R.

converted to "t" or "f" through ta.pull.

converted to "t" or "f" in a STREAM Rexec call.

RODBC recognizes a boolean value as a numeric data type in R (1 for TRUE, and 0 for FALSE).

bit [(n)] SQL_CHAR / 1 "char" "char" "numeric" "character" RODBC always converts a "bit" data type into a numeric data type in R. For example, "0010" is converted to 10 (ten).

When using values for comparison, Aster R package functions require the values to be in single quotes in order to produce valid results.

bit varying [(n)] SQL_VARCHAR / 12 "varchar" "varchar" "numeric" "character" RODBC always converts a "bit" data type into a numeric data type in R. For example, "0010" is converted to 10 (ten).

When using values for comparison, Aster R package functions require the values to be in single quotes in order to produce valid results.

bytea SQL_VARBINARY / -3 "varchar" "varchar" "character" "character“ When ByteaAsVarchar=1 in the odbc.ini file, values will all digits, "NaN", "NA", and so on are recognized as numeric values in R by RODBC.
character [(n)] SQL_CHAR / 1 "char" "char" "character" "character" RODBC will truncate character values by 65535 bytes.

When ByteaAsVarchar=1 in the odbc.ini file, values will all digits, "NaN", "NA", and so on are recognized as numeric values in R by RODBC.

character varying [(n)] SQL_VARCHAR / 12 "varchar" "varchar" "character" "character" RODBC will truncate character values by 65535 bytes.

When ByteaAsVarchar=1 in the odbc.ini file, values will all digits, "NaN", "NA", and so on are recognized as numeric values in R by RODBC.

date SQL_TYPE_DATE / 91 "date" "date" "Date" "Date" The range of the "Date" data type in R is 0001-01-1 through 9999-12-31.

Out-of-range values can be converted to a "character" data type by ta.pull().

time [(p)] without time zone SQL_TYPE_TIME / 92 "time" "time" "character" "character"  
time [(p)] with time zone SQL_VARCHAR / 12 (9) "varchar" "varchar" "character" "character"  
timestamp [(p)] without time zone SQL_TYPE_TIMESTAMP / 93 "timestamp" "timestamp" c("POSIXct", "POSIXt") c("POSIXct", "POSIXt") The range of the "POSIXct" data type in R is 0001-01-1 through 9999-12-31.

Out-of-range values can be converted to the "character" data type by ta.pull().

timestamp [(p)] with time zone SQL_VARCHAR / 12 (9) "varchar" "varchar" "character" "character"  
interval SQL_VARCHAR / 12 "varchar" "varchar" "character" "character"  
serial { local | global } SQL_INTEGER / 4 "int" "int" "integer" "integer"  
bigserial { local | global } SQL_BIGINT / -5 "unknown" "bigint" "numeric" "numeric"  
ip4 SQL_VARCHAR / 12 "varchar" "varchar" "character" "character"  
ip4range SQL_VARCHAR / 12 "varchar" "varchar" "character" "character"  
uuid SQL_VARCHAR / 12 "varchar" "varchar" "character" "character"