- Newest
- Most votes
- Most comments
I apologize for the confusion, but there seems to be a misunderstanding regarding the TIME data type support in Amazon Athena. Let me clarify the situation for you.
Athena does indeed support the TIME data type, but there's a distinction between how it's used in DDL (Data Definition Language) statements and DML (Data Manipulation Language) queries.
For DDL statements like CREATE TABLE, Athena uses Apache Hive data type names. In this context, the TIME data type is not available.
However, for DML queries like SELECT, CTAS (Create Table As Select), and INSERT INTO, Athena uses Trino data type names. In these DML operations, the TIME data type is supported.
Specifically, for a column with values in the format HH:MM:SS, you can use the TIME data type in your DML queries. Athena expects the corresponding column or property of the data to be a string in the ISO format HH:MM:SS, or a built-in time type like those for Parquet or ORC.
If you're encountering a syntax error when using TIME, it's possible that you're trying to use it in a DDL statement where it's not supported. In such cases, you might need to use a different data type like STRING or VARCHAR for the column definition, and then cast it to TIME in your queries.
For example, you could define the column as VARCHAR in your CREATE TABLE statement, and then use CAST(column_name AS TIME) in your SELECT queries.
It's worth noting that Athena also supports TIME with specific precision (e.g., TIME(3)) and TIME WITH TIME ZONE for more advanced time-based operations in DML queries.
If you continue to experience issues, you may want to double-check your query syntax or consult the latest Athena documentation, as features and supported data types can evolve over time.
Sources
Supported column data types - Amazon Athena
Work with timestamp data - Amazon Athena
Data types in Amazon Athena - Amazon Athena
Relevant content
- asked 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 4 months ago
- AWS OFFICIALUpdated 10 months ago