Every column in a table has a name and a data type. The data type tells HAWQ how much physical storage to set aside for the column and the form in which the data is stored. This section includes information about HAWQ data types, null and default values, and data conversions.
SAS/ACCESS Interface to HAWQ does not directly support any data types that are not listed below. Any columns using these types are read into SAS as character strings.
For more information about HAWQ data types and to determine which data types are available for your version of HAWQ, see your HAWQ documentation.
Here are the data types that SAS/ACCESS Interface to HAWQ supports:
| CHAR(n) |
| VARCHAR(n) |
| TEXT |
| BIGINT | REAL |
| SMALLINT | FLOAT |
| INTEGER | DECIMAL | DEC | NUMERIC |
| DOUBLE PRECISION |
| DATE |
| TIME |
| TIMESTAMP |
HAWQ has a special value called NULL. A HAWQ NULL value means an absence of information and is analogous to a SAS missing value. When SAS/ACCESS reads a HAWQ NULL value, it interprets it as a SAS missing value. When loading SAS tables from HAWQ sources, SAS/ACCESS stores HAWQ NULL values as SAS missing values.
In HAWQ tables, NULL values are valid in all columns by default. There are two methods to specify a column in a HAWQ table so that it requires data:
When creating HAWQ tables with SAS/ACCESS, you can use the DBNULL= data set option to specify the treatment of NULL values. For more information about how SAS handles NULL values, see Potential Result Set Differences When Processing Null Data.
Once you know whether a HAWQ column enables NULLs or the host system provides a default value for a column that is specified as NOT NULL WITH DEFAULT, you can write selection criteria and enter values to update a table. Unless a column is specified as NOT NULL or NOT NULL DEFAULT, it enables NULL values.
To control how the DBMS handles SAS missing character values, use the NULLCHAR= and NULLCHARVAL= data set options.
The following table shows the default formats that SAS/ACCESS Interface to HAWQ assigns to SAS variables when using the LIBNAME statement to read from a HAWQ table.
These default formats are based on HAWQ column attributes.
|
HAWQ Data Type |
SAS Data Type |
Default SAS Format |
|---|---|---|
|
CHAR(n)1 |
character |
$w. |
|
VARCHAR(n)1 |
character |
$w. |
|
BYTEA |
character |
$w3 |
|
INTEGER |
numeric |
11. |
|
SMALLINT |
numeric |
6. |
|
BIGINT |
numeric |
20. |
|
DECIMAL(p,s)2 |
numeric |
w.d |
|
NUMERIC(p,s)2 |
numeric |
w.d |
|
REAL |
numeric |
none |
|
TIME |
numeric |
TIME8. |
|
DATE |
numeric |
DATE9. |
|
TIMESTAMP |
numeric |
DATETIME25.6 |
| 1 n in HAWQ data types is equivalent to w in SAS formats. | ||
| 2 p and s in HAWQ numeric data types are equivalent to w and d in SAS formats. | ||
| 3 Because the Greenplum ODBC driver does the conversion, this field is displayed as if the $HEXw. format were applied. | ||
The next table shows the default HAWQ data types that SAS/ACCESS assigns to SAS variable formats during output operations when you use the LIBNAME statement.
|
SAS Variable Format |
HAWQ Data Type |
|---|---|
|
w.d |
DECIMAL(p,s)2 |
|
$w. |
VARCHAR(n)1 |
|
datetime formats |
TIMESTAMP |
|
date formats |
DATE |
|
time formats |
TIME |
| 1 n in HAWQ data types is equivalent to w in SAS formats. | |
| 2 p and s in HAWQ numeric data types are equivalent to w and d in SAS formats. | |