MCMZL
MCMZL

Reputation: 1146

cast function with expression :: types throw mismatched inputs ":" error in Amazon Athena Query Editor

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 ?

Upvotes: 0

Views: 276

Answers (1)

Guru Stron
Guru Stron

Reputation: 143078

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

Upvotes: 1

Related Questions