FAILED: ParseException line 1:2 cannot acknowledge input near '('Select' '*'.

Asked 1 years ago, Updated 1 years ago, 103 views

FAILED: ParseException line 1:2 cannot acknowledge input near' ('Select' *'

said he.What's wrong?

(
    Select
      *
    , Cast(Concat(Substr(timestamp, 1, 4), '-', Substr(timestamp, 5, 2), '-', Substr(timestamp, 7, 2), '', Substr(timestamp, 9, 2), ':', Substr(timestamp, 11, 2), ':', Substr(timestamp, 13, 2), _ Ascamp)))
    From
      test
    Where
      st = '${env:20151001}'
      And '${env:lastDate}'<=Substr(timestamp, 1,8)
      And Substr(timestamp, 1,8)<='${env:1101}'
      And Substr(timestamp, 1,8)<= Substr(up_time, 1,8)
  )axis

amazon hadoop

2022-09-30 21:17

1 Answers

Is it correct that the SQL execution engine here is Hive?
If you don't use this query as a subquery, I think it will work if you write it as follows.

Select
  *
, Cast(Concat(Substr(timestamp, 1, 4), '-', Substr(timestamp, 5, 2), '-', Substr(timestamp, 7, 2), '', Substr(timestamp, 9, 2), ':', Substr(timestamp, 11, 2), ':', Substr(timestamp, 13, 2), _ Ascamp)))
From
  test
Where
  st = '${env:20151001}'
  And '${env:lastDate}'<=Substr(timestamp, 1,8)
  And Substr(timestamp, 1,8)<='${env:1101}'
  And Substr(timestamp, 1,8)<= Substr(up_time, 1,8)

If you want to give the results of this query to other queries, you can write them as you have asked, but you will need a higher-level query.

SELECT
  axis.hoge
from
(
  -- Query questions
)axis


2022-09-30 21:17

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.