converting to timestamp with time zone failed on Athena

前端 未结 3 1347
醉话见心
醉话见心 2021-02-19 14:50

I\'m trying to create to following view:

CREATE OR REPLACE VIEW view_events AS 
(
   SELECT
     \"rank\"() OVER (PARTITION BY \"tb1\".\"innerid\" ORDER BY \"tb1         


        
3条回答
  •  花落未央
    2021-02-19 15:21

    Ran into something similar on something that I was working on recently. AWS Support pointed me to Davos solution but it didn't end up working for my case. The solution that ended up working from me was:

    create or replace view db_name.vw_name AS
    select
        from_unixtime(cast(to_unixtime(current_timestamp) AS bigint)) as field_name
    from db_name.tbl_name
    

    This will convert the output of current_timestamp which is timestamp with time zone to timestamp

    If you want to verify the data type of the field, you can use:

    select typeof(field_name) from db_name.vw_name
    

    Hope that helps!

提交回复
热议问题