Github user kkhatua commented on a diff in the pull request: https://github.com/apache/drill/pull/1024#discussion_r149463638 --- Diff: exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillCursor.java --- @@ -239,6 +259,11 @@ QueryDataBatch getNext() throws UserException, InterruptedException { } return qdb; } + + // Check and throw SQLTimeoutException + if ( parent.timeoutInSeconds > 0 && parent.elapsedTimer.elapsed(TimeUnit.SECONDS) >= parent.timeoutInSeconds ) { --- End diff -- Good point, and I thought it might help in avoiding going into polling all together. However, the granularity of the timeout is in seconds, so 50ms is insignificant. If I do a check before the poll, I'd need to do after the poll as well.. over a 50ms window. So, a post-poll check works fine, because we'll, at most, exceed the timeout by 50ms. So a timeout of 1sec would occur in 1.05sec. For any larger timeout values, the 50ms is of diminishing significance.
---