Data types
- Last Updated: October 27, 2020
- 1 minute read
- DataDirect Connectors
- ODBC
- Apache Spark SQL 8.0
- Documentation
The following table shows how the Apache Spark SQL data types are mapped to the standard ODBC data types.
| Apache Spark SQL | ODBC |
|---|---|
| Bigint | SQL_BIGINT |
| Boolean | SQL_BIT |
| Date | SQL_DATE |
| Decimal | SQL_DECIMAL |
| Double | SQL_DOUBLE |
| Float | SQL_REAL |
| Int | SQL_INTEGER |
| Smallint | SQL_SMALLINT |
| String1 | SQL_WVARCHAR or SQL_WLONGVARCHAR |
| Timestamp | SQL_TYPE_TIMESTAMP |
| Tinyint | SQL_TINYINT |
| Varchar 2 | SQL_WVARCHAR |
1 If the String Describe Type connection option is set to
-9 (the default), the String data type maps to WVARCHAR. If
String Describe Type is set to -10, String maps to
WLONGVARCHAR. String Describe Type affects all columns reported as String, even
columns that were originally cast as Varchar. This is important to note because the
Spark Thrift server, when returning result metadata for Varchar columns, reports
column type as (12) STRING and precision as 2147483647.
2 When returning result set metadata for Varchar
columns, the Spark Thrift server reports the column type as (12) STRING and the precision as
2147483647. For the latest information about this issue, refer to the Apache JIRA SPARK-5918 issue
Web page:
https://issues.apache.org/jira/browse/SPARK-5918