Edamame
Edamame

Reputation: 25366

Impala query: Exception: Syntax error caused by cast function

I have the following Impala query

select session_id, max(cast(milli_ts) as integer), min(cast(milli_ts) as integer)from my_table group by session_id

But got the following errors:

HiveServer2Error: AnalysisException: Syntax error in line 10:
...sion_id, max(cast(milli_ts) as integer), min(cast(mill...
                             ^
Encountered: )
Expected: AND, AS, BETWEEN, DIV, ILIKE, IN, IREGEXP, IS, LIKE, NOT, OR, REGEXP, RLIKE

CAUSED BY: Exception: Syntax error

Any idea what I missed? Thanks!

Upvotes: 1

Views: 3045

Answers (1)

David דודו Markovitz
David דודו Markovitz

Reputation: 44941

The correct syntax for CAST is as following:

cast(milli_ts as integer)

Upvotes: 1

Related Questions