2

This IMPALA sub query restriction consumed too much of my time. So I decided to post here to save people some time.

If you are making an inner query for the FROM part you cant make your standard SQL to work. I.e:

select count(*) from (SELECT * from mytable WHERE id="12345")

is not working giving the following error.

ERROR: AnalysisException: Syntax error in line 1: ...WHERE id="12345") ^ Encountered: EOF Expected: AS, IDENTIFIER

CAUSED BY: Exception: Syntax error

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
math_law
  • 391
  • 1
  • 4
  • 16

1 Answers1

2

You simply have to create a temporary alias (stupidalias) for the inner query result.

select count(*) from (SELECT * from mytable WHERE id="12345") as stupidalias
math_law
  • 391
  • 1
  • 4
  • 16