DRILL-2548: JDBC Driver - check for bad data from server and prevent SqlException
Project: http://git-wip-us.apache.org/repos/asf/drill/repo Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/7289cabb Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/7289cabb Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/7289cabb Branch: refs/heads/master Commit: 7289cabb5e7f9bed4a38607ccdfc09f803e2c235 Parents: 1aad02c Author: Parth Chandra <pchan...@maprtech.com> Authored: Tue Mar 24 10:19:07 2015 -0700 Committer: Parth Chandra <pchan...@maprtech.com> Committed: Fri Apr 24 16:21:55 2015 -0700 ---------------------------------------------------------------------- exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillCursor.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/drill/blob/7289cabb/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillCursor.java ---------------------------------------------------------------------- diff --git a/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillCursor.java b/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillCursor.java index 857a885..41b89ce 100644 --- a/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillCursor.java +++ b/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillCursor.java @@ -114,10 +114,14 @@ public class DrillCursor implements Cursor { try { QueryDataBatch qrb = resultsListener.getNext(); recordBatchCount++; - while (qrb != null && qrb.getHeader().getRowCount() == 0 && !first) { + while (qrb != null && (qrb.getHeader().getRowCount() == 0 || qrb.getData() == null ) && !first) { qrb.release(); qrb = resultsListener.getNext(); recordBatchCount++; + if(qrb != null && qrb.getData()==null){ + qrb.release(); + return false; + } } first = false;