Reputation:
STR_TO_DATE(string_time,'%Y-%m-%d %H:%i:%s') > (select timestamp from table)
this line causes the error 'Function str_to_date not registered' in Athena. is there any way to work around this problem?
Upvotes: 1
Views: 1396
Reputation: 132862
All databases have their own set of functions, even though some are common and exist in more than one. STR_TO_DATE
is not available in Athena, but there are lots of other date and time functions that can be used to achieve the same goal.
You can find links to all functions supported by Athena here: https://docs.aws.amazon.com/athena/latest/ug/presto-functions.html
In your case I think you can use either parse_datetime
, which looks like it works like STR_TO_DATE
in your example.
Alternatively I think you could cast the string to a timestamp since the format you are using matches Athena's, try CAST(string_time AS TIMESTAMP)
Upvotes: 1