drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amansi...@apache.org
Subject [1/4] drill git commit: DRILL-5213: Prepared statement for actual query is missing the query text
Date Mon, 17 Apr 2017 05:24:06 GMT
Repository: drill
Updated Branches:
  refs/heads/master 9df3403a0 -> 72903d014


DRILL-5213: Prepared statement for actual query is missing the query text

close apache/drill#812


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/dfb5f4bb
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/dfb5f4bb
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/dfb5f4bb

Branch: refs/heads/master
Commit: dfb5f4bb5ac771ea64431b8482141ded02d8d859
Parents: 9df3403
Author: Vitalii Diravka <vitalii.diravka@gmail.com>
Authored: Mon Apr 10 18:54:21 2017 +0000
Committer: Aman Sinha <asinha@maprtech.com>
Committed: Sun Apr 16 22:20:05 2017 -0700

----------------------------------------------------------------------
 .../server/rest/profile/ProfileResources.java   |  4 +++-
 .../apache/drill/exec/work/foreman/Foreman.java | 15 +++++++++----
 .../drill/exec/work/foreman/QueryManager.java   | 22 +++++++++++++-------
 3 files changed, 29 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/dfb5f4bb/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/ProfileResources.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/ProfileResources.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/ProfileResources.java
index e1f2099..044b792 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/ProfileResources.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/ProfileResources.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -227,6 +227,8 @@ public class ProfileResources {
         }
       }
 
+      Collections.sort(finishedQueries, Collections.reverseOrder());
+
       return new QProfiles(runningQueries, finishedQueries, errors);
     } catch (Exception e) {
       throw UserException.resourceError(e)

http://git-wip-us.apache.org/repos/asf/drill/blob/dfb5f4bb/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java
index 94d0658..a2b09a8 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java
@@ -35,7 +35,6 @@ import java.util.concurrent.TimeUnit;
 import org.apache.drill.common.CatastrophicFailure;
 import org.apache.drill.common.EventProcessor;
 import org.apache.drill.common.concurrent.ExtendedLatch;
-import org.apache.drill.common.config.DrillConfig;
 import org.apache.drill.common.exceptions.ExecutionSetupException;
 import org.apache.drill.common.exceptions.UserException;
 import org.apache.drill.common.logical.LogicalPlan;
@@ -537,9 +536,10 @@ public class Foreman implements Runnable {
           .build(logger);
     }
 
-    final String sql = serverState.getSqlQuery();
-    logger.info("Prepared statement query for QueryId {} : {}", queryId, sql);
-    runSQL(sql);
+    queryText = serverState.getSqlQuery();
+    logger.info("Prepared statement query for QueryId {} : {}", queryId, queryText);
+    runSQL(queryText);
+
   }
 
   private static void validatePlan(final PhysicalPlan plan) throws ForemanSetupException
{
@@ -1222,6 +1222,13 @@ public class Foreman implements Runnable {
   }
 
   /**
+   * @return sql query text of the query request
+   */
+  public String getQueryText() {
+    return queryText;
+  }
+
+  /**
    * Used by {@link FragmentSubmitListener} to track the number of submission failures.
    */
   private static class FragmentSubmitFailures {

http://git-wip-us.apache.org/repos/asf/drill/blob/dfb5f4bb/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/QueryManager.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/QueryManager.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/QueryManager.java
index 7305025..77c20a5 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/QueryManager.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/QueryManager.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -18,7 +18,6 @@
 package org.apache.drill.exec.work.foreman;
 
 import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
 import io.netty.buffer.ByteBuf;
 
 import java.util.List;
@@ -329,14 +328,19 @@ public class QueryManager implements AutoCloseable {
   }
 
   private QueryInfo getQueryInfo() {
-    return QueryInfo.newBuilder()
-        .setQuery(runQuery.getPlan())
+    final String queryText = foreman.getQueryText();
+    QueryInfo.Builder queryInfoBuilder = QueryInfo.newBuilder()
         .setState(foreman.getState())
         .setUser(foreman.getQueryContext().getQueryUserName())
         .setForeman(foreman.getQueryContext().getCurrentEndpoint())
         .setStart(startTime)
-        .setOptionsJson(getQueryOptionsAsJson())
-        .build();
+        .setOptionsJson(getQueryOptionsAsJson());
+
+    if (queryText != null) {
+      queryInfoBuilder.setQuery(queryText);
+    }
+
+    return queryInfoBuilder.build();
   }
 
   public QueryProfile getQueryProfile() {
@@ -344,8 +348,8 @@ public class QueryManager implements AutoCloseable {
   }
 
   private QueryProfile getQueryProfile(UserException ex) {
+    final String queryText = foreman.getQueryText();
     final QueryProfile.Builder profileBuilder = QueryProfile.newBuilder()
-        .setQuery(runQuery.getPlan())
         .setUser(foreman.getQueryContext().getQueryUserName())
         .setType(runQuery.getType())
         .setId(queryId)
@@ -372,6 +376,10 @@ public class QueryManager implements AutoCloseable {
       profileBuilder.setPlan(planText);
     }
 
+    if (queryText != null) {
+      profileBuilder.setQuery(queryText);
+    }
+
     fragmentDataMap.forEach(new OuterIter(profileBuilder));
 
     return profileBuilder.build();


Mime
View raw message