drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From par...@apache.org
Subject drill git commit: DRILL-1955: C++ client should provide a clean method for detecting query completion in the async API.
Date Fri, 09 Jan 2015 22:29:18 GMT
Repository: drill
Updated Branches:
  refs/heads/master 7638dbb82 -> f82064973


DRILL-1955: C++ client should provide a clean method for detecting query completion in the
async API.


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

Branch: refs/heads/master
Commit: f8206497331e66902fc8779b3e431472a36a2e8b
Parents: 7638dbb
Author: Parth Chandra <pchandra@maprtech.com>
Authored: Thu Jan 8 09:52:30 2015 -0800
Committer: Parth Chandra <pchandra@maprtech.com>
Committed: Fri Jan 9 14:28:15 2015 -0800

----------------------------------------------------------------------
 contrib/native/client/src/clientlib/drillClient.cpp  |  5 +++++
 .../native/client/src/clientlib/drillClientImpl.cpp  | 14 +++++++-------
 .../native/client/src/include/drill/drillClient.hpp  | 15 +++++++++++----
 3 files changed, 23 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/f8206497/contrib/native/client/src/clientlib/drillClient.cpp
----------------------------------------------------------------------
diff --git a/contrib/native/client/src/clientlib/drillClient.cpp b/contrib/native/client/src/clientlib/drillClient.cpp
index a8cfe8c..02bc1a4 100644
--- a/contrib/native/client/src/clientlib/drillClient.cpp
+++ b/contrib/native/client/src/clientlib/drillClient.cpp
@@ -297,6 +297,11 @@ RecordIterator* DrillClient::submitQuery(Drill::QueryType t, const std::string&
 void* DrillClient::getApplicationContext(QueryHandle_t handle){
     return ((DrillClientQueryResult*)handle)->getListenerContext();
 }
+
+status_t DrillClient::getQueryStatus(QueryHandle_t handle){
+    return ((DrillClientQueryResult*)handle)->getQueryStatus();
+}
+
 std::string& DrillClient::getError(){
     return m_pImpl->getError()->msg;
 }

http://git-wip-us.apache.org/repos/asf/drill/blob/f8206497/contrib/native/client/src/clientlib/drillClientImpl.cpp
----------------------------------------------------------------------
diff --git a/contrib/native/client/src/clientlib/drillClientImpl.cpp b/contrib/native/client/src/clientlib/drillClientImpl.cpp
index 84aa6cd..c832a79 100644
--- a/contrib/native/client/src/clientlib/drillClientImpl.cpp
+++ b/contrib/native/client/src/clientlib/drillClientImpl.cpp
@@ -664,7 +664,6 @@ status_t DrillClientImpl::processQueryStatusResult(exec::shared::QueryResult*
qr
                     ret=handleQryError(ret, qr->error(0), pDrillClientQueryResult);
                 }
                 break;
-
                 // m_pendingRequests should be decremented when the query is
                 // completed
             case exec::shared::QueryResult_QueryState_CANCELED:
@@ -677,15 +676,16 @@ status_t DrillClientImpl::processQueryStatusResult(exec::shared::QueryResult*
qr
                 break;
             case exec::shared::QueryResult_QueryState_COMPLETED:
                 {
-                    // DO NOT call handleTerminateQryState because that
-                    // signals an error condition and the synchronous API
-                    // will then free the query result object without it
-                    // being processed by the application.
-                    ret=QRY_COMPLETED;
+                    //Not clean to call the handleTerminatedQryState method
+                    //because it signals an error to the listener. 
+                    //The ODBC driver expects this though and the sync API
+                    //handles this (luckily). 
+                    ret=handleTerminatedQryState(ret,
+                            getMessage(ERR_QRY_COMPLETED),
+                            pDrillClientQueryResult);
                     m_pendingRequests--;
                 }
                 break;
-
             default:
                 {
                     DRILL_LOG(LOG_TRACE) << "DrillClientImpl::processQueryResult: Unknown
Query State.\n";

http://git-wip-us.apache.org/repos/asf/drill/blob/f8206497/contrib/native/client/src/include/drill/drillClient.hpp
----------------------------------------------------------------------
diff --git a/contrib/native/client/src/include/drill/drillClient.hpp b/contrib/native/client/src/include/drill/drillClient.hpp
index 490c823..0204855 100644
--- a/contrib/native/client/src/include/drill/drillClient.hpp
+++ b/contrib/native/client/src/include/drill/drillClient.hpp
@@ -191,6 +191,17 @@ class DECLSPEC_DRILL_CLIENT RecordIterator{
 
 class DECLSPEC_DRILL_CLIENT DrillClient{
     public:
+        /*
+         * Get the application context from query handle
+         */
+        static void* getApplicationContext(QueryHandle_t handle);
+
+        /*
+         * Get the query status from query handle
+         */
+        static status_t getQueryStatus(QueryHandle_t handle);
+
+
         DrillClient();
         ~DrillClient();
 
@@ -238,10 +249,6 @@ class DECLSPEC_DRILL_CLIENT DrillClient{
          * back. The listener callback will return the handle in the ctx parameter.
          */
         status_t submitQuery(Drill::QueryType t, const std::string& plan, pfnQueryResultsListener
listener, void* listenerCtx, QueryHandle_t* qHandle);
-        /*
-         * Get the application context from query handle
-         */
-        static void* getApplicationContext(QueryHandle_t handle);
 
         /*
          * Submit a query asynchronously and wait for results to be returned through an iterator
that returns


Mime
View raw message