How to set date DDL in Amazon Athena
I tried to create a table in Amazon's Athena using this DDL however after querying, I see that all of my dates values (in transactiondate field) are NULL. The source data format is simply mm/dd/yyyy i.e. 08/01/2017.
作者: mrmatt11 的来源 发布者: 2017 年 12 月 27 日
CREATE EXTERNAL TABLE
String value of date has to be in specific format for Athena to understand it as Date type. DDL of Athena are handled in Hive.
As per hive the expected format is 'yyyy-mm-dd'. Reference
The same goes for Timestamp type. Timestamps in text files have to use the format yyyy-mm-dd hh:mm:ss[.f...]. If they are in another format, declare them as the appropriate type (INT, FLOAT, STRING, etc.) and use a UDF to convert them to timestamps.作者: Dhaval 发布者: 28.12.2017 02:29