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