简体   繁体   中英

Hive ParseException: cannot recognize input near 'create' 'table'

I am trying to conduct a hive query of the form

with (
select a,b from some_db.some_table
) as my_subquery

create table some_other_db.new_table as select * from my_subquery

And I am getting the error

cannot recognize input near 'create' 'table' 'some_other_db' in statement

How do I resolve?

The issue is in hive you cannot include create statements after a with statement. They need to be before.

The following query worked:

create table some_other_db.new_table as 
with (
select a,b from some_db.some_table
) as my_subquery

select * from my_subquery

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM