Home > other >  cast function with expression :: types throw mismatched inputs ":" error in Amazon Athena
cast function with expression :: types throw mismatched inputs ":" error in Amazon Athena

Time:02-17

According to Amazon Athena documentation one should be able to use the syntax expression :: type to cast a variable. Trying to run the example on the Query Editor throws an error:

select 123.456::decimal(2,1);
>>> line 6:15: mismatched input ':'. Expecting: '%', '*', ' ', '-', '.', '/', 'AT', '[', '||', <expression>

I guess the issues is related to serialization / inputs types. Is there a way (like character escaping) to make it pass and use this convenient syntax ?

CodePudding user response:

This link is not Athena documentation but Redshift one. Athena is build on top of Presto which supports cast and try_cast conversion functions.

  • Related