From fd63e5a5142b458616157ce857f2c1eeae3eac2a Mon Sep 17 00:00:00 2001 From: Clint Wylie Date: Wed, 21 Dec 2022 19:32:53 -0800 Subject: [PATCH] fix issue with jdbc and query metrics (#13608) * fix issue with metrics emitting and jdbc results by getting yielder from query processing thread * more better --- .../org/apache/druid/sql/avatica/DruidJdbcResultSet.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sql/src/main/java/org/apache/druid/sql/avatica/DruidJdbcResultSet.java b/sql/src/main/java/org/apache/druid/sql/avatica/DruidJdbcResultSet.java index 70ec88ff1bc..1f75a135177 100644 --- a/sql/src/main/java/org/apache/druid/sql/avatica/DruidJdbcResultSet.java +++ b/sql/src/main/java/org/apache/druid/sql/avatica/DruidJdbcResultSet.java @@ -26,7 +26,6 @@ import org.apache.druid.java.util.common.IAE; import org.apache.druid.java.util.common.ISE; import org.apache.druid.java.util.common.StringUtils; import org.apache.druid.java.util.common.concurrent.Execs; -import org.apache.druid.java.util.common.guava.Sequence; import org.apache.druid.java.util.common.guava.Yielder; import org.apache.druid.java.util.common.guava.Yielders; import org.apache.druid.java.util.common.logger.Logger; @@ -237,13 +236,12 @@ public class DruidJdbcResultSet implements Closeable // Execute the first step: plan the query and return a sequence to use // to get values. - final Sequence sequence = queryExecutor.submit(stmt::execute).get().getResults(); - + final Yielder yielder = queryExecutor.submit(() -> Yielders.each(stmt.execute().getResults())).get(); // Subsequent fetch steps are done via the async "fetcher". fetcher = fetcherFactory.newFetcher( // We can't apply limits greater than Integer.MAX_VALUE, ignore them. maxRowCount >= 0 && maxRowCount <= Integer.MAX_VALUE ? (int) maxRowCount : Integer.MAX_VALUE, - Yielders.each(sequence) + yielder ); signature = AbstractDruidJdbcStatement.createSignature( stmt.prepareResult(),