Reply
New Contributor
Posts: 3
Registered: ‎08-14-2017

executeUpdate with CDH 5.3 does not return count of rows modified

[ Edited ]

Hi,

 

I am using CDH hive driver to send data to hadoop. I am using executeUpdate() and expecting that it would return the number of rows. However, it always returns 0. 

 

1. Is there some setting to be modified in hive-site.xml to support this?

2. If this functionality is not supported in CDH, what is the recommended way of getting the updated row count? Or is there a way to get the status message or something which would convey more details about what transpired during the executeUpdate() call?

 

Thanks

Champion
Posts: 547
Registered: ‎05-16-2016

Re: executeUpdate with CDH 5.3 does not return count of rows modified

are you firing a DDL or DML statement ? 

could you share the code ? 

New Contributor
Posts: 3
Registered: ‎08-14-2017

Re: executeUpdate with CDH 5.3 does not return count of rows modified

Hi,

 

Thanks for the reply.

I am using a DML statement.

 

Here is the sample code:

 

final StringBuffer sql = new StringBuffer( "INSERT INTO TABLE empData VALUES (1, 'John Doe'); " );
pstmt = con.prepareStatement( sql.toString() );
int result = pstmt.executeUpdate ( );

 

Here, the result variable always gets the value 0.

 

Highlighted
Champion
Posts: 547
Registered: ‎05-16-2016

Re: executeUpdate with CDH 5.3 does not return count of rows modified

did you try to do a select statement in the empData to see if the insert is successful after executing your code 

if it return zero it clearly states that it has no done nothing . 

Announcements