我想用雅典娜把日期缩短到今天。输入和选择语句如下所示:
create table ...
usagestartdate timestamp,
usageneddate timestamp,
...
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'
WITH SERDEPROPERTIES (
'serialization.format' = ',',
'field.delim' = ',',
"timestamp.formats" = "yyyy-MM-dd'T'HH:mm:ss.SSSSS'Z'")
LOCATION 's3:
then to get just the day
select...
resource string
day(usagestartdate)
sum(usagehours)
1条答案
按热度按时间a2mppw5e1#
要检索timestamp列的日期,需要使用基础prestodb引擎中的datetime函数。
因此,生成的select如下所示: