Fix missing QueryCompleteEvent for Presto on Spark
- Catch INVALID_SESSION_PROPERTY error
- QueryCompleteEvent is created in catch block
@@ -362,23 +362,15 @@ public class PrestoSparkQueryExecutionFactory
authenticatorProviders);
Session session = sessionSupplier.createSession(queryId, sessionContext);
-
session = sessionPropertyDefaults.newSessionWithDefaultProperties(session, Optional.empty(), Optional.empty());
WarningCollector warningCollector = warningCollectorFactory.create(getWarningHandlingLevel(session));
+ PlanAndMore planAndMore = null;
+ try {
TransactionId transactionId = transactionManager.beginTransaction(true);
session = session.beginTransactionId(transactionId, transactionManager, accessControl);
- // including queueing time
- Duration queryMaxRunTime = getQueryMaxRunTime(session);
- // excluding queueing time
- Duration queryMaxExecutionTime = getQueryMaxExecutionTime(session);
- // pick a smaller one as we are not tracking queueing for Presto on Spark
- Duration queryTimeout = queryMaxRunTime.compareTo(queryMaxExecutionTime) < 0 ? queryMaxRunTime : queryMaxExecutionTime;
-
- long queryCompletionDeadline = System.currentTimeMillis() + queryTimeout.toMillis();
-
queryMonitor.queryCreatedEvent(
new BasicQueryInfo(createQueryInfo(
session,
@@ -391,8 +383,15 @@ public class PrestoSparkQueryExecutionFactory
Optional.empty(),
warningCollector)));
- PlanAndMore planAndMore = null;
- try {
+ // including queueing time
+ Duration queryMaxRunTime = getQueryMaxRunTime(session);
+ // excluding queueing time
+ Duration queryMaxExecutionTime = getQueryMaxExecutionTime(session);
+ // pick a smaller one as we are not tracking queueing for Presto on Spark
+ Duration queryTimeout = queryMaxRunTime.compareTo(queryMaxExecutionTime) < 0 ? queryMaxRunTime : queryMaxExecutionTime;
+
+ long queryCompletionDeadline = System.currentTimeMillis() + queryTimeout.toMillis();
+
settingsRequirements.verify(sparkContext, session);
queryStateTimer.beginAnalyzing();
