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-5968: Add support for empty service_host user property
Date Fri, 17 Nov 2017 01:28:42 GMT
Repository: drill
Updated Branches:
  refs/heads/master acc5ed927 -> 5490f3dc0


DRILL-5968: Add support for empty service_host user property

This closes #1037


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

Branch: refs/heads/master
Commit: 5490f3dc0133fb9f0f24229e09c4cc053192ac5b
Parents: acc5ed9
Author: Rob Wu <robwu15@gmail.com>
Authored: Tue Nov 14 23:27:29 2017 -0800
Committer: Parth Chandra <parthc@apache.org>
Committed: Thu Nov 16 17:28:06 2017 -0800

----------------------------------------------------------------------
 contrib/native/client/src/clientlib/drillClientImpl.cpp  |  4 ++--
 .../native/client/src/include/drill/userProperties.hpp   | 11 +++++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/5490f3dc/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 4a915a4..3435561 100644
--- a/contrib/native/client/src/clientlib/drillClientImpl.cpp
+++ b/contrib/native/client/src/clientlib/drillClientImpl.cpp
@@ -84,7 +84,7 @@ connectionStatus_t DrillClientImpl::connect(const char* connStr, DrillUserProper
         handleConnError(m_pChannel->getError());
         return ret;
     }
-    props->setProperty(USERPROP_SERVICE_HOST, m_pChannel->getEndpoint()->getHost());
+    props->setDefaultProperty(USERPROP_SERVICE_HOST, m_pChannel->getEndpoint()->getHost());
     m_bIsConnected = true;
     return ret;
 }
@@ -116,7 +116,7 @@ connectionStatus_t DrillClientImpl::connect(const char* host, const char*
port,
         handleConnError(m_pChannel->getError());
         return ret;
     }
-    props->setProperty(USERPROP_SERVICE_HOST, m_pChannel->getEndpoint()->getHost());
+    props->setDefaultProperty(USERPROP_SERVICE_HOST, m_pChannel->getEndpoint()->getHost());
     m_bIsConnected = true;
     return ret;
 }

http://git-wip-us.apache.org/repos/asf/drill/blob/5490f3dc/contrib/native/client/src/include/drill/userProperties.hpp
----------------------------------------------------------------------
diff --git a/contrib/native/client/src/include/drill/userProperties.hpp b/contrib/native/client/src/include/drill/userProperties.hpp
index 62a04f7..f5d6783 100644
--- a/contrib/native/client/src/include/drill/userProperties.hpp
+++ b/contrib/native/client/src/include/drill/userProperties.hpp
@@ -28,6 +28,17 @@ class DECLSPEC_DRILL_CLIENT DrillUserProperties{
         static const std::map<std::string, uint32_t> USER_PROPERTIES;
 
         DrillUserProperties(){};
+        
+        /// @brief Update the property value associate with the property key if the value
is 
+        /// empty.
+        /// 
+        /// @param in_propName              The property name.
+        /// @param in_propValue             The property value.
+        void setDefaultProperty(const std::string& in_propName, const std::string&
in_propValue){
+            if (!isPropSet(in_propName) || m_properties[in_propName].empty()){
+                m_properties[in_propName] = in_propValue;
+            }
+        }
 
         void setProperty( const std::string& propName, const std::string& propValue){
             std::pair< std::string, std::string> in = make_pair(propName, propValue);


Mime
View raw message