You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Peter Hall <Pe...@quest.com> on 2010/11/24 06:07:31 UTC

EXPLAIN over JDBC

Hi,

When running a query like:
EXPLAIN SELECT * FROM mytable
over the JDBC driver, calling ResultSet.next() returns false at the end of the abstract syntax tree, even though there are more rows to fetch.

So typical JDBC processing code of the form:
while (rs.next()) {
 //process a row
}

stops before the end of the results.

Is this a known bug? If not I'll file a bug report for it.

Cheers,
Peter

PS Through trial and error (and a little stepping through the Hive driver with a debugger) I discovered you can process to the end of the ResultSet with code of the form:
while (true) {
 if(!rs.next() && !rs.next()) {
  break;
 }
 //process a row
}

I can't vouch for how cross database compatible this code is, but it seems to work OK for Hive and MySQL with my limited testing.