Member since
03-15-2017
2
Posts
0
Kudos Received
0
Solutions
03-28-2017
03:27 PM
hive jdbc Statement.getUpdateCount() always returning -1, instead it should return number of rows inserted/updated/deleted. Here is the sample code. --------------------------------- Class.forName("org.apache.hive.jdbc.HiveDriver");
String url = "jdbc:hive2://XXXX:10000/default";
Connection con = DriverManager.getConnection(url, "XXX", "XXX"); Statement stmt = con.createStatement();
//HiveStatement stmt = (HiveStatement)con.createStatement(); String sql = "INSERT INTO TAB_CNT_2 select * from TAB_CNT_1";
//String sql = "LOAD DATA INPATH '/user/XXXXXX.txt' INTO TABLE TAB_CNT_2"
stmt.execute(sql);
System.out.println("update row count="+stmt.getUpdateCount());
stmt.close();
con.close(); ---------------------------------- Looks like there are hive specific statement classes (HiveStatement, HivePreparedStatement) not sure how to instanciate these classes and also not sure if they return correct updateCount . Appreciate any help.
... View more
Labels:
- Labels:
-
Apache Hive
03-15-2017
03:13 PM
I am trying to create a hive table using another hive table using a simple JDBC program. This some times hangs the hive.
when this happens all other sqls(select/insert/delete... etc.) through the other jdbc program are aslo hanging, but I could execute the same sqls through other hive client interfaces like sql workbench, sql developer etc. here are the sqls
1> CREATE TABLE XXXX AS SELECT * FROM XXXX WHERE 1=2
2> ANALYZE TABLE XXXX COMPUTE STATISTICS -- not sure if this is causing issue, just pasting here This may not happen every time, need to keep trying for few times with different table. The work around is, is to reboot the entire hadoop cluster, stoping just the hive service alone will not help.
I dont see any error message in the hive/hadoop log files. Environment:
1> Hive version 1.2.1000.2.5.0.0-1245
2> HDP version 2.5.0.0-1245 3> Jdbc jars hive-jdbc-1.2.1.jar,httpmime-4.1.3.jar,httpclient-4.3.3.jar,httpcore-4.3.jar,hive-service-2.0.0.jar,
hadoop-core-0.20.2.jar,hive-common-0.8.0.jar,hive_metastore.jar,libthrift-0.9.0.jar Appriciate your help.
... View more
Labels: