Search code examples
snowflake-cloud-data-platformparquet

Snowflake to S3 unloading (parquet format), Epoch timestamp is getting unloaded as negative value


I am trying to unload snowflake table to S3 in parquet-format, but the EPOCH timestamp is getting as negative value. The select query at snowflake side gives the correct epoch value, but the unloaded parquet file (viewed under parquet-viewer) has a negative value. snowflake value = "1665136431585000" & parquet value = "-914239720" .Can someone point the missing piece ~thankx

alter session set ENABLE_UNLOAD_PHYSICAL_TYPE_OPTIMIZATION = false; 

copy [email protected]_mystage/ABC/abc.parquet from ( 
  (date_part(EPOCH_MICROSECONDS ,transactiontimestamp)) :: INT as transactiontimestamp
from mydb.public.mytable
 
)
FILE_FORMAT = (TYPE = PARQUET COMPRESSION = None) 
header = true
overwrite = true
SINGLE = TRUE ;

Solution

  • casting it to snowflake-bigint worked