Created on 01-09-2017 11:34 AM - edited 09-16-2022 03:53 AM
Hi,
I'm trying to execute a simple hiveql statement like the following: insert into table1 select * from table2.
Both tables have the same schema but different store options, that is, table1 is stored as avro and table2 as parquet.
I copied jdbc4 driver to project's location and I can obtain a connection to hiveserver2 without any issues. However, when I try to execute the above query, the following exception occurrs.
Only AEQuery is supported. java.sql.SQLException: Only AEQuery is supported. at com.cloudera.hive.hive.querytranslation.HiveQueryTranslator.translate(HiveQueryTranslator.java:86) at com.cloudera.hive.hive.querytranslation.HiveQueryTranslator.translate(HiveQueryTranslator.java:74) at com.cloudera.hive.hivecommon.dataengine.HiveJDBCDSIExtQueryExecutor.execute(HiveJDBCDSIExtQueryExecutor.java:168) at com.cloudera.hive.jdbc.common.SStatement.executeNoParams(SStatement.java:2719) at com.cloudera.hive.jdbc.common.SStatement.execute(SStatement.java:549) at py.com.personal.hive.HiveDataLoad.insert(HiveDataLoad.java:46) at InsertTest.testHiveInsert(InsertTest.java:23) Caused by: com.cloudera.hive.support.exceptions.ErrorException: Only AEQuery is supported.
Can somebody please tell me what I'm doing wrong or how this can be solved?
This is my code:
if (this.conn == null) { this.conn = this.cm.connect(); } Statement stmt = this.conn.createStatement(); String sql = "INSERT INTO " + toTable + " SELECT * FROM " + fromTable; stmt.execute(sql); stmt.close();
Thanks.
Created 01-10-2017 10:36 AM
The statement should be insert into **TABLE** toTable select * from fromTable, instead of insert into toTable select * from table. Hope this helps somebody else.
Created 01-10-2017 10:36 AM
The statement should be insert into **TABLE** toTable select * from fromTable, instead of insert into toTable select * from table. Hope this helps somebody else.