Data Types

The Simba Athena ODBC Driver supports many common data formats, converting between Athena data types and SQL data types.

The following table lists the supported data type mappings.

Athena Type SQL Type

ARRAY

  • SQL_VARCHAR if the Use SQL Unicode Types option (the UseSQLUnicodeTypes property) is disabled.
  • SQL_WVARCHAR if the Use SQL Unicode Types option (the UseSQLUnicodeTypes property) is enabled.

BIGINT

SQL_BIGINT

BINARY

SQL_VARBINARY

BOOLEAN

SQL_BIT

CHAR
  • SQL_CHAR if the Use SQL Unicode Types option (the UseSQLUnicodeTypes property) is disabled.
  • SQL_WCHAR if the Use SQL Unicode Types option (the UseSQLUnicodeTypes property) is enabled.

DATE

Note:

Not supported for Parquet files.

  • SQL_TYPE_DATE if the application uses ODBC version 3.00 or later.
  • SQL_DATE if the application uses an ODBC version earlier than 3.00.

DECIMAL (p, s)

SQL_DECIMAL

DOUBLE

SQL_DOUBLE

FLOAT SQL_REAL

INTEGER

Note:

Although Athena reports integer data as type INT, the connector reports integer data as type INTEGER to ensure compatibility with standard BI tools. For more information, see Integer Support.

SQL_INTEGER

MAP

  • SQL_VARCHAR if the Use SQL Unicode Types option (the UseSQLUnicodeTypes property) is disabled.
  • SQL_WVARCHAR if the Use SQL Unicode Types option (the UseSQLUnicodeTypes property) is enabled.

SMALLINT

SQL_SMALLINT

STRING

  • SQL_VARCHAR if the Use SQL Unicode Types option (the UseSQLUnicodeTypes property) is disabled.
  • SQL_WVARCHAR if the Use SQL Unicode Types option (the UseSQLUnicodeTypes property) is enabled.

STRUCT

  • SQL_VARCHAR if the Use SQL Unicode Types option (the UseSQLUnicodeTypes property) is disabled.
  • SQL_WVARCHAR if the Use SQL Unicode Types option (the UseSQLUnicodeTypes property) is enabled.

TIMESTAMP

  • SQL_TYPE_TIMESTAMP if the application uses ODBC version 3.00 or later.
  • SQL_TIMESTAMP if the application uses an ODBC version earlier than 3.00.

TINYINT

SQL_TINYINT

VARCHAR

  • SQL_VARCHAR if the Use SQL Unicode Types option (the UseSQLUnicodeTypes property) is disabled.
  • SQL_WVARCHAR if the Use SQL Unicode Types option (the UseSQLUnicodeTypes property) is enabled.

Integer Support

Athena combines two different implementations of the integer data type:

  • In Data Definition Language (DDL) queries, Athena uses the INT data type from Apache Hive.
  • In all other queries, Athena uses the INTEGER data type from Presto.

To support the CAST queries that are used in many BI tools, the connector reports integer data as type INTEGER even though Athena reports the data as type INT.

Be aware that, when executing DDL queries, you must specify integer data using INT as the data type.

Note:

Athena supports some but not all DDL statements. For a list of the supported DDL statements, see "SQL and HiveQL Reference" in the Amazon Athena API Referencehttp://docs.aws.amazon.com/athena/latest/ug/language-reference.html.