Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

JDBC4 Hive Driver error: Only AEQuery is supported.

avatar
Explorer

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.

1 ACCEPTED SOLUTION

avatar
Explorer

The statement should be insert into **TABLE** toTable select * from fromTable, instead of insert into toTable select * from table. Hope this helps somebody else.

View solution in original post

1 REPLY 1

avatar
Explorer

The statement should be insert into **TABLE** toTable select * from fromTable, instead of insert into toTable select * from table. Hope this helps somebody else.