diff options
author | Parth Chandra <pchandra@maprtech.com> | 2014-05-30 11:17:40 -0700 |
---|---|---|
committer | Jacques Nadeau <jacques@apache.org> | 2014-06-19 20:29:53 -0700 |
commit | aaa4db74b215e03ad0e1334cfc18964972d93a3b (patch) | |
tree | b880e6c31c48f5f79037976edf1a2b27576e4030 | |
parent | ff39fb8383e038aadbf4810a6b4ad5f22d25a181 (diff) |
DRILL-875: Fixes for DRILL-707, DRILL-780, DRILL-835 (Schema change), DRILL-852, DRILL-876, DRILL_877, DRILL-878, DRILL-890
29 files changed, 5650 insertions, 1328 deletions
diff --git a/contrib/native/client/CMakeLists.txt b/contrib/native/client/CMakeLists.txt index a306780a4..9ac705b8c 100644 --- a/contrib/native/client/CMakeLists.txt +++ b/contrib/native/client/CMakeLists.txt @@ -15,7 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.6) project(drillclient) @@ -26,20 +26,21 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmakeModules/") # Find Boost -set(Boost_USE_STATIC_LIBS OFF) -set(Boost_USE_MULTITHREADED ON) -set(Boost_USE_STATIC_RUNTIME OFF) -find_package(Boost REQUIRED COMPONENTS regex system date_time chrono thread log log_setup) +set(Boost_USE_STATIC_LIBS OFF) +set(Boost_USE_MULTITHREADED ON) +set(Boost_USE_STATIC_RUNTIME OFF) +find_package(Boost 1.53.0 REQUIRED COMPONENTS regex system date_time chrono thread ) include_directories(${Boost_INCLUDE_DIRS}) -if(CMAKE_COMPILER_IS_GNUCXX) - set(CMAKE_EXE_LINKER_FLAGS "-lrt -lpthread") -endif() +if(CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_EXE_LINKER_FLAGS "-lrt -lpthread") + set(CMAKE_CXX_FLAGS "-fPIC") +endif() add_definitions(-DBOOST_ALL_DYN_LINK) # Find Protobufs -find_package(Protobuf REQUIRED) +find_package(Protobuf REQUIRED ) include_directories(${PROTOBUF_INCLUDE_DIR}) #Find Zookeeper @@ -50,13 +51,13 @@ find_package(Zookeeper REQUIRED ) # # Preprocess to fix protobuf .proto definitions -add_subdirectory("${CMAKE_SOURCE_DIR}/src/protobuf") +add_subdirectory("${CMAKE_SOURCE_DIR}/src/protobuf") # protobuf includes are required by clientlib include_directories(${ProtoHeadersDir}) include_directories(${ProtoIncludesDir}) # Build the Client Library as a shared library -add_subdirectory("${CMAKE_SOURCE_DIR}/src/clientlib") +add_subdirectory("${CMAKE_SOURCE_DIR}/src/clientlib") include_directories(${CMAKE_SOURCE_DIR}/src/include ${Zookeeper_INCLUDE_DIRS} ) # add a DEBUG preprocessor macro @@ -68,7 +69,7 @@ set_property( # Link directory link_directories(/usr/local/lib) -add_executable(querySubmitter example/querySubmitter.cpp ) +add_executable(querySubmitter example/querySubmitter.cpp ) target_link_libraries(querySubmitter ${Boost_LIBRARIES} ${PROTOBUF_LIBRARY} drillClient protomsgs ) diff --git a/contrib/native/client/example/querySubmitter.cpp b/contrib/native/client/example/querySubmitter.cpp index 96e2c6557..9d24e6885 100644 --- a/contrib/native/client/example/querySubmitter.cpp +++ b/contrib/native/client/example/querySubmitter.cpp @@ -20,9 +20,23 @@ #include <iostream> #include <stdio.h> #include <stdlib.h> -#include <boost/asio.hpp> #include "drill/drillc.hpp" +Drill::status_t SchemaListener(void* ctx, Drill::FieldDefPtr fields, Drill::DrillClientError* err){ + if(!err){ + printf("SCHEMA CHANGE DETECTED:\n"); + for(size_t i=0; i<fields->size(); i++){ + std::string name= fields->at(i)->getName(); + printf("%s\t", name.c_str()); + } + printf("\n"); + return Drill::QRY_SUCCESS ; + }else{ + std::cerr<< "ERROR: " << err->msg << std::endl; + return Drill::QRY_FAILURE; + } +} + Drill::status_t QueryResultsListener(void* ctx, Drill::RecordBatch* b, Drill::DrillClientError* err){ if(!err){ b->print(std::cout, 0); // print all rows @@ -79,18 +93,19 @@ void print(const Drill::FieldMetadata* pFieldMetadata, void* buf, size_t sz){ return; } -int nOptions=5; +int nOptions=6; struct Option{ char name[32]; char desc[128]; bool required; -}qsOptions[]= { +}qsOptions[]= { {"plan", "Plan files separated by semicolons", false}, {"query", "Query strings, separated by semicolons", false}, {"type", "Query type [physical|logical|sql]", true}, {"connectStr", "Connect string", true}, - {"api", "API type [sync|async]", true} + {"api", "API type [sync|async]", true}, + {"logLevel", "Logging level [trace|debug|info|warn|error|fatal]", false} }; std::map<std::string, std::string> qsOptionValues; @@ -136,7 +151,7 @@ int parseArgs(int argc, char* argv[]){ } } } - if(error){ + if(error){ printUsage(); exit(1); } @@ -170,7 +185,7 @@ int readPlans(const std::string& planList, std::vector<std::string>& plans){ std::string plan((std::istreambuf_iterator<char>(f)), (std::istreambuf_iterator<char>())); std::cout << "plan:" << plan << std::endl; plans.push_back(plan); - } + } return 0; } @@ -201,6 +216,18 @@ bool validate(const std::string& type, const std::string& query, const std::stri return true; } +Drill::logLevel_t getLogLevel(const char *s){ + if(s!=NULL){ + if(!strcmp(s, "trace")) return Drill::LOG_TRACE; + if(!strcmp(s, "debug")) return Drill::LOG_DEBUG; + if(!strcmp(s, "info")) return Drill::LOG_INFO; + if(!strcmp(s, "warn")) return Drill::LOG_WARNING; + if(!strcmp(s, "error")) return Drill::LOG_ERROR; + if(!strcmp(s, "fatal")) return Drill::LOG_FATAL; + } + return Drill::LOG_ERROR; +} + int main(int argc, char* argv[]) { try { @@ -213,26 +240,29 @@ int main(int argc, char* argv[]) { std::string planList=qsOptionValues["plan"]; std::string api=qsOptionValues["api"]; std::string type_str=qsOptionValues["type"]; + std::string logLevel=qsOptionValues["logLevel"]; - exec::user::QueryType type; + exec::shared::QueryType type; if(!validate(type_str, queryList, planList)){ exit(1); } + Drill::logLevel_t l=getLogLevel(logLevel.c_str()); + std::vector<std::string> queryInputs; if(type_str=="sql" ){ readQueries(queryList, queryInputs); - type=exec::user::SQL; + type=exec::shared::SQL; }else if(type_str=="physical" ){ readPlans(planList, queryInputs); - type=exec::user::PHYSICAL; + type=exec::shared::PHYSICAL; }else if(type_str == "logical"){ readPlans(planList, queryInputs); - type=exec::user::LOGICAL; + type=exec::shared::LOGICAL; }else{ readQueries(queryList, queryInputs); - type=exec::user::SQL; + type=exec::shared::SQL; } std::vector<std::string>::iterator queryInpIter; @@ -245,9 +275,9 @@ int main(int argc, char* argv[]) { Drill::DrillClient client; // To log to file - //DrillClient::initLogging("/var/log/drill/", LOG_INFO); + //DrillClient::initLogging("/var/log/drill/", l); // To log to stderr - Drill::DrillClient::initLogging(NULL, Drill::LOG_INFO); + Drill::DrillClient::initLogging(NULL, l); if(client.connect(connectStr.c_str())!=Drill::CONN_SUCCESS){ std::cerr<< "Failed to connect with error: "<< client.getError() << " (Using:"<<connectStr<<")"<<std::endl; @@ -269,26 +299,27 @@ int main(int argc, char* argv[]) { // get fields. row=0; Drill::RecordIterator* pRecIter=*recordIterIter; - std::vector<Drill::FieldMetadata*>& fields = pRecIter->getColDefs(); - while((ret=pRecIter->next())==Drill::QRY_SUCCESS){ + Drill::FieldDefPtr fields= pRecIter->getColDefs(); + while((ret=pRecIter->next()), ret==Drill::QRY_SUCCESS || ret==Drill::QRY_SUCCESS_WITH_INFO){ + fields = pRecIter->getColDefs(); row++; - if(row%4095==0){ - for(size_t i=0; i<fields.size(); i++){ - std::string name= fields[i]->getName(); + if( (ret==Drill::QRY_SUCCESS_WITH_INFO && pRecIter->hasSchemaChanged() )|| ( row%100==1)){ + for(size_t i=0; i<fields->size(); i++){ + std::string name= fields->at(i)->getName(); printf("%s\t", name.c_str()); } printf("\n"); } printf("ROW: %ld\t", row); - for(size_t i=0; i<fields.size(); i++){ + for(size_t i=0; i<fields->size(); i++){ void* pBuf; size_t sz; pRecIter->getCol(i, &pBuf, &sz); - print(fields[i], pBuf, sz); + print(fields->at(i), pBuf, sz); } printf("\n"); } if(ret!=Drill::QRY_NO_MORE_DATA){ - std::cerr<< pRecIter->getError(); + std::cerr<< pRecIter->getError() << std::endl; } client.freeQueryIterator(&pRecIter); } @@ -296,11 +327,13 @@ int main(int argc, char* argv[]) { for(queryInpIter = queryInputs.begin(); queryInpIter != queryInputs.end(); queryInpIter++) { Drill::QueryHandle_t* qryHandle = new Drill::QueryHandle_t; client.submitQuery(type, *queryInpIter, QueryResultsListener, NULL, qryHandle); + client.registerSchemaChangeListener(qryHandle, SchemaListener); queryHandles.push_back(qryHandle); } client.waitForResults(); for(queryHandleIter = queryHandles.begin(); queryHandleIter != queryHandles.end(); queryHandleIter++) { client.freeQueryResources(*queryHandleIter); + delete *queryHandleIter; } } client.close(); diff --git a/contrib/native/client/readme.linux b/contrib/native/client/readme.linux new file mode 100644 index 000000000..fbdb6e4e5 --- /dev/null +++ b/contrib/native/client/readme.linux @@ -0,0 +1,96 @@ +/* + * 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 + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +CentOS 6.5 build + +Install Prerequisites +--------------------- +0) Install development tools + $>yum groupinstall 'Development Tools' + +1) CMAKE 2.8 + $> yum install cmake28 + +2.1) Download protobuf 2.5 from : + http://rpm.pbone.net/index.php3/stat/4/idpl/23552166/dir/centos_6/com/protobuf-2.5.0-16.1.x86_64.rpm.html + http://rpm.pbone.net/index.php3/stat/4/idpl/23552167/dir/centos_6/com/protobuf-compiler-2.5.0-16.1.x86_64.rpm.html + http://rpm.pbone.net/index.php3/stat/4/idpl/23552169/dir/centos_6/com/protobuf-devel-2.5.0-16.1.x86_64.rpm.html + +2.2) Install Protobufs + $> sudo yum install protobuf + $> sudo yum install protobuf-compiler + $> sudo yum install protobuf-devel + +3) +3.1) Install Zookeeper prerequisites + - autoconf 2.59 or greater (should be installed with dev tools) + - cppunit 1.10.x or higher + +3.1.1) install cppuint + $> sudo yum install cppunit + $> sudo yum install cppunit-devel + +3.2) Download Zookeeper from : + - http://apache.mirror.quintex.com/zookeeper/zookeeper-3.4.6/ + - untar and then follow instructions in ZOOKEEPER_DIR/src/c/README to build and install the client libs + +3.3) run autoreconf + $> autoreconf -if + +3.4) Build Zookeeper libs + $> ./configure --enable-debug --with-syncapi --enable-static --enable-shared + $> make && sudo make install + +4) Install boost. The minumim version required is 1.53, which will probably have to be built from source + + # Remove any previous boost + $> sudo yum -y erase boost + + # fetch the boost source rpm and create binary rpms + $> wget ftp://ftp.icm.edu.pl/vol/rzm2/linux-fedora-secondary/development/rawhide/source/SRPMS/b/boost-1.53.0-6.fc19.src.rpm + $> rpmbuild --rebuild boost-1.53.0-6.fc19.src.rpm + + #install the binary rpms + #(Note: the "rpm" utility does not clean up old versions very well.) + $> sudo yum -y install ~/rpmbuild/RPMS/x86_64/* + +OR + Download and build using boost build. + See this link for how to build: http://www.boost.org/doc/libs/1_53_0/more/getting_started/unix-variants.html#prepare-to-use-a-boost-library-binary + + +Build drill client +------------------- + $> cd DRILL_DIR/contrib/native/client + $> mkdir build + $> cd build && cmake28 -G "Unix Makefiles" -D CMAKE_BUILD_TYPE=Debug .. + $> make + +Test +---- +Run query submitter from the command line + $> querySubmitter query='select * from dfs.`/Users/pchandra/work/data/tpc-h/customer.parquet`' type=sql connectStr=local=10.250.0.146:31010 api=async logLevel=trace + +Valgrind +-------- +Examples to run Valgrind and see the log in Valkyrie + $> valgrind --leak-check=yes --xml=yes --xml-file=qs-vg-log-a.xml querySubmitter query='select LINEITEM from dfs.`/Users/pchandra/work/data/tpc-h/customer.parquet`' type=sql connectStr=local=10.250.0.146:31010 api=async logLevel=trace + $> valkyrie -l qs-vg-log-a.xml + + diff --git a/contrib/native/client/resources/parquet_scan_union_screen_physical.json b/contrib/native/client/resources/parquet_scan_union_screen_physical.json index e677b156e..81a62a386 100644 --- a/contrib/native/client/resources/parquet_scan_union_screen_physical.json +++ b/contrib/native/client/resources/parquet_scan_union_screen_physical.json @@ -34,7 +34,7 @@ @id: 3, child: 2, pop: "screen" - } + } ] } diff --git a/contrib/native/client/resources/simple_plan.json b/contrib/native/client/resources/simple_plan.json index ad3cdc739..8fede75f2 100644 --- a/contrib/native/client/resources/simple_plan.json +++ b/contrib/native/client/resources/simple_plan.json @@ -13,7 +13,7 @@ cp: {type: "classpath"} }, query:[ - + { @id:"1", op: "scan", @@ -38,7 +38,7 @@ input:"2", op: "filter", expr: "donuts.ppu < 1.00" - }, + }, { @id:"4", input:"3", @@ -51,7 +51,7 @@ input:"4", op: "collapsingaggregate", within: "ppusegment", - carryovers: ["donuts.ppu"], + carryovers: ["donuts.ppu"], aggregations: [ { ref: "donuts.typeCount", expr: "count(1)" }, { ref: "donuts.quantity", expr: "sum(quantity)" }, @@ -65,7 +65,7 @@ orderings: [ {order: "DESC", expr: "donuts.ppu" } ] - }, + }, { @id:"7", input:"6", @@ -80,7 +80,7 @@ op: "limit", first: 0, last: 100 - }, + }, { @id:"9", input:"8", @@ -88,7 +88,7 @@ memo: "output sink", storageengine: "console", target: {pipe: "STD_OUT"} - } + } ] } diff --git a/contrib/native/client/scripts/fixProtodefs.sh b/contrib/native/client/scripts/fixProtodefs.sh index 7cb9710d2..f3ce78134 100755 --- a/contrib/native/client/scripts/fixProtodefs.sh +++ b/contrib/native/client/scripts/fixProtodefs.sh @@ -43,7 +43,7 @@ main() { if [ -e ${TARGDIR}/${FNAME} ] then - if [ ${SRCDIR}/${FNAME} -nt ${TARGDIR}/${FNAME} ] + if [ ${SRCDIR}/${FNAME} -nt ${TARGDIR}/${FNAME} ] then fixFile ${FNAME} fi diff --git a/contrib/native/client/src/clientlib/CMakeLists.txt b/contrib/native/client/src/clientlib/CMakeLists.txt index d07f9309e..7cd5dfba8 100644 --- a/contrib/native/client/src/clientlib/CMakeLists.txt +++ b/contrib/native/client/src/clientlib/CMakeLists.txt @@ -18,14 +18,15 @@ # Drill Client library -set (CLIENTLIB_SRC_FILES +set (CLIENTLIB_SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/decimalUtils.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/drillClient.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/drillClientImpl.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/recordBatch.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rpcEncoder.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rpcDecoder.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/errmsgs.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/drillClient.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/drillClientImpl.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/recordBatch.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/rpcEncoder.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/rpcDecoder.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/errmsgs.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/logger.cpp ) include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../include ) diff --git a/contrib/native/client/src/clientlib/decimalUtils.cpp b/contrib/native/client/src/clientlib/decimalUtils.cpp index 39439c5b9..3885faa19 100644 --- a/contrib/native/client/src/clientlib/decimalUtils.cpp +++ b/contrib/native/client/src/clientlib/decimalUtils.cpp @@ -60,7 +60,7 @@ DecimalValue getDecimalValueFromByteBuf(SlicedByteBuf& data, size_t startIndex, bool needsEndiannessSwap = !truncateScale; // Initialize the BigDecimal, first digit in the ByteBuf has the sign so mask it out - cpp_int decimalDigits = (needsEndiannessSwap ? + cpp_int decimalDigits = (needsEndiannessSwap ? bswap_32(data.getUint32(startIndex)) & 0x7FFFFFFF : (data.getUint32(startIndex) & 0x7FFFFFFF)); diff --git a/contrib/native/client/src/clientlib/drillClient.cpp b/contrib/native/client/src/clientlib/drillClient.cpp index 9a9b919ce..10480b4d5 100644 --- a/contrib/native/client/src/clientlib/drillClient.cpp +++ b/contrib/native/client/src/clientlib/drillClient.cpp @@ -17,17 +17,11 @@ */ -#include <boost/format.hpp> -#include <boost/log/expressions.hpp> -#include <boost/log/sinks/text_file_backend.hpp> -#include <boost/log/utility/setup/file.hpp> -#include <boost/log/utility/setup/common_attributes.hpp> -#include <boost/log/sources/severity_logger.hpp> - #include "drill/drillClient.hpp" #include "drill/recordBatch.hpp" #include "drillClientImpl.hpp" #include "errmsgs.hpp" +#include "logger.hpp" #include "Types.pb.h" @@ -50,84 +44,96 @@ DrillClientInitializer::~DrillClientInitializer(){ logLevel_t DrillClientConfig::s_logLevel=LOG_ERROR; uint64_t DrillClientConfig::s_bufferLimit=-1; -boost::mutex DrillClientConfig::s_mutex; +int32_t DrillClientConfig::s_socketTimeout=180; +boost::mutex DrillClientConfig::s_mutex; DrillClientConfig::DrillClientConfig(){ initLogging(NULL); } +DrillClientConfig::~DrillClientConfig(){ + Logger::close(); +} + void DrillClientConfig::initLogging(const char* path){ - if(path!=NULL){ - std::string f=std::string(path)+"drill_clientlib_%N.log"; - try{ - boost::log::add_file_log - ( - boost::log::keywords::file_name = f.c_str(), - boost::log::keywords::rotation_size = 10 * 1024 * 1024, - boost::log::keywords::time_based_rotation = - boost::log::sinks::file::rotation_at_time_point(0, 0, 0), - boost::log::keywords::format = "[%TimeStamp%]: %Message%" - ); - }catch(std::exception& e){ - // do nothing. Logging will happen to stderr - BOOST_LOG_TRIVIAL(error) << "Logging could not be initialized. Logging to stderr." ; - } - } - boost::log::add_common_attributes(); - boost::log::core::get()->set_filter(boost::log::trivial::severity >= s_logLevel); + Logger::init(path); } void DrillClientConfig::setLogLevel(logLevel_t l){ - boost::lock_guard<boost::mutex> bufferLock(DrillClientConfig::s_mutex); + boost::lock_guard<boost::mutex> configLock(DrillClientConfig::s_mutex); s_logLevel=l; - boost::log::core::get()->set_filter(boost::log::trivial::severity >= s_logLevel); + Logger::s_level=l; + //boost::log::core::get()->set_filter(boost::log::trivial::severity >= s_logLevel); } void DrillClientConfig::setBufferLimit(uint64_t l){ - boost::lock_guard<boost::mutex> bufferLock(DrillClientConfig::s_mutex); + boost::lock_guard<boost::mutex> configLock(DrillClientConfig::s_mutex); s_bufferLimit=l; } uint64_t DrillClientConfig::getBufferLimit(){ - boost::lock_guard<boost::mutex> bufferLock(DrillClientConfig::s_mutex); + boost::lock_guard<boost::mutex> configLock(DrillClientConfig::s_mutex); return s_bufferLimit; } +void DrillClientConfig::setSocketTimeout(int32_t t){ + boost::lock_guard<boost::mutex> configLock(DrillClientConfig::s_mutex); + s_socketTimeout=t; +} + +int32_t DrillClientConfig::getSocketTimeout(){ + boost::lock_guard<boost::mutex> configLock(DrillClientConfig::s_mutex); + return s_socketTimeout; +} + logLevel_t DrillClientConfig::getLogLevel(){ - boost::lock_guard<boost::mutex> bufferLock(DrillClientConfig::s_mutex); + boost::lock_guard<boost::mutex> configLock(DrillClientConfig::s_mutex); return s_logLevel; } RecordIterator::~RecordIterator(){ if(m_pColDefs!=NULL){ - for(std::vector<Drill::FieldMetadata*>::iterator it=m_pColDefs->begin(); - it!=m_pColDefs->end(); + for(std::vector<Drill::FieldMetadata*>::iterator it=m_pColDefs->begin(); + it!=m_pColDefs->end(); ++it){ delete *it; } } - delete this->m_pColDefs; - this->m_pColDefs=NULL; delete this->m_pQueryResult; this->m_pQueryResult=NULL; + if(this->m_pCurrentRecordBatch!=NULL){ + DRILL_LOG(LOG_TRACE) << "Deleted last Record batch " << (void*) m_pCurrentRecordBatch << std::endl; + delete this->m_pCurrentRecordBatch; this->m_pCurrentRecordBatch=NULL; + } } -std::vector<Drill::FieldMetadata*>& RecordIterator::getColDefs(){ +FieldDefPtr RecordIterator::getColDefs(){ if(m_pQueryResult->hasError()){ return DrillClientQueryResult::s_emptyColDefs; } //NOTE: if query is cancelled, return whatever you have. Client applications job to deal with it. - if(this->m_pColDefs==NULL){ + if(this->m_pColDefs==NULL || this->hasSchemaChanged()){ if(this->m_pCurrentRecordBatch==NULL){ this->m_pQueryResult->waitForData(); if(m_pQueryResult->hasError()){ return DrillClientQueryResult::s_emptyColDefs; } } - std::vector<Drill::FieldMetadata*>* pColDefs = new std::vector<Drill::FieldMetadata*>; + if(this->hasSchemaChanged()){ + if(m_pColDefs!=NULL){ + for(std::vector<Drill::FieldMetadata*>::iterator it=m_pColDefs->begin(); + it!=m_pColDefs->end(); + ++it){ + delete *it; + } + m_pColDefs->clear(); + //delete m_pColDefs; m_pColDefs=NULL; + } + } + FieldDefPtr pColDefs( new std::vector<Drill::FieldMetadata*>); { //lock after we come out of the wait. boost::lock_guard<boost::mutex> bufferLock(this->m_recordBatchMutex); - std::vector<Drill::FieldMetadata*>& currentColDefs=DrillClientQueryResult::s_emptyColDefs; + boost::shared_ptr< std::vector<Drill::FieldMetadata*> > currentColDefs=DrillClientQueryResult::s_emptyColDefs; if(this->m_pCurrentRecordBatch!=NULL){ currentColDefs=this->m_pCurrentRecordBatch->getColumnDefs(); }else{ @@ -138,7 +144,7 @@ std::vector<Drill::FieldMetadata*>& RecordIterator::getColDefs(){ currentColDefs=pR->getColumnDefs(); } } - for(std::vector<Drill::FieldMetadata*>::iterator it=currentColDefs.begin(); it!=currentColDefs.end(); ++it){ + for(std::vector<Drill::FieldMetadata*>::iterator it=currentColDefs->begin(); it!=currentColDefs->end(); ++it){ Drill::FieldMetadata* fmd= new Drill::FieldMetadata; fmd->copy(*(*it));//Yup, that's 2 stars pColDefs->push_back(fmd); @@ -146,7 +152,7 @@ std::vector<Drill::FieldMetadata*>& RecordIterator::getColDefs(){ } this->m_pColDefs = pColDefs; } - return *this->m_pColDefs; + return this->m_pColDefs; } status_t RecordIterator::next(){ @@ -160,12 +166,19 @@ status_t RecordIterator::next(){ if(!this->m_pQueryResult->isCancelled()){ if(this->m_pCurrentRecordBatch==NULL || this->m_currentRecord==this->m_pCurrentRecordBatch->getNumRecords()){ boost::lock_guard<boost::mutex> bufferLock(this->m_recordBatchMutex); - delete this->m_pCurrentRecordBatch; //free the previous record batch + if(this->m_pCurrentRecordBatch !=NULL){ + DRILL_LOG(LOG_TRACE) << "Deleted old Record batch " << (void*) m_pCurrentRecordBatch << std::endl; + delete this->m_pCurrentRecordBatch; //free the previous record batch + } this->m_currentRecord=0; this->m_pCurrentRecordBatch=this->m_pQueryResult->getNext(); - BOOST_LOG_TRIVIAL(trace) << "Fetched new Record batch " ; + if(this->m_pCurrentRecordBatch != NULL){ + DRILL_LOG(LOG_TRACE) << "Fetched new Record batch " << std::endl; + }else{ + DRILL_LOG(LOG_TRACE) << "No new Record batch found " << std::endl; + } if(this->m_pCurrentRecordBatch==NULL || this->m_pCurrentRecordBatch->getNumRecords()==0){ - BOOST_LOG_TRIVIAL(trace) << "No more data." ; + DRILL_LOG(LOG_TRACE) << "No more data." << std::endl; ret = QRY_NO_MORE_DATA; }else if(this->m_pCurrentRecordBatch->hasSchemaChanged()){ ret=QRY_SUCCESS_WITH_INFO; @@ -213,11 +226,16 @@ status_t RecordIterator::cancel(){ return QRY_CANCEL; } -void RecordIterator::registerSchemaChangeListener(pfnSchemaListener* l){ - //TODO: +bool RecordIterator::hasSchemaChanged(){ + return m_currentRecord==0 && m_pCurrentRecordBatch!=NULL && m_pCurrentRecordBatch->hasSchemaChanged(); } -std::string& RecordIterator::getError(){ +void RecordIterator::registerSchemaChangeListener(pfnSchemaListener l){ + assert(m_pQueryResult!=NULL); + this->m_pQueryResult->registerSchemaChangeListener(l); +} + +const std::string& RecordIterator::getError(){ return m_pQueryResult->getError()->msg; } @@ -243,7 +261,7 @@ connectionStatus_t DrillClient::connect(const char* connectStr ){ ret=this->m_pImpl->connect(connectStr); if(ret==CONN_SUCCESS) - ret=this->m_pImpl->ValidateHandShake()?CONN_SUCCESS:CONN_HANDSHAKE_FAILED; + ret=this->m_pImpl->validateHandShake()?CONN_SUCCESS:CONN_HANDSHAKE_FAILED; return ret; } @@ -256,13 +274,13 @@ void DrillClient::close() { this->m_pImpl->Close(); } -status_t DrillClient::submitQuery(exec::user::QueryType t, const std::string& plan, pfnQueryResultsListener listener, void* listenerCtx, QueryHandle_t* qHandle){ +status_t DrillClient::submitQuery(::exec::shared::QueryType t, const std::string& plan, pfnQueryResultsListener listener, void* listenerCtx, QueryHandle_t* qHandle){ DrillClientQueryResult* pResult=this->m_pImpl->SubmitQuery(t, plan, listener, listenerCtx); *qHandle=(QueryHandle_t)pResult; - return QRY_SUCCESS; + return QRY_SUCCESS; } -RecordIterator* DrillClient::submitQuery(exec::user::QueryType t, const std::string& plan, DrillClientError* err){ +RecordIterator* DrillClient::submitQuery(::exec::shared::QueryType t, const std::string& plan, DrillClientError* err){ RecordIterator* pIter=NULL; DrillClientQueryResult* pResult=this->m_pImpl->SubmitQuery(t, plan, NULL, NULL); if(pResult){ @@ -280,6 +298,12 @@ void DrillClient::waitForResults(){ this->m_pImpl->waitForResults(); } +void DrillClient::registerSchemaChangeListener(QueryHandle_t* handle, pfnSchemaListener l){ + if(handle!=NULL){ + ((DrillClientQueryResult*)(*handle))->registerSchemaChangeListener(l); + } +} + void DrillClient::freeQueryResources(QueryHandle_t* handle){ delete (DrillClientQueryResult*)(*handle); *handle=NULL; diff --git a/contrib/native/client/src/clientlib/drillClientImpl.cpp b/contrib/native/client/src/clientlib/drillClientImpl.cpp index 14b4f7dcf..07673961c 100644 --- a/contrib/native/client/src/clientlib/drillClientImpl.cpp +++ b/contrib/native/client/src/clientlib/drillClientImpl.cpp @@ -20,53 +20,73 @@ #include <string.h> #include <boost/asio.hpp> #include <boost/bind.hpp> +#include <boost/date_time/posix_time/posix_time_duration.hpp> #include <boost/lexical_cast.hpp> #include <boost/thread.hpp> -#include <boost/log/trivial.hpp> #include <zookeeper/zookeeper.h> #include "drill/drillClient.hpp" #include "drill/recordBatch.hpp" #include "drillClientImpl.hpp" #include "errmsgs.hpp" +#include "logger.hpp" #include "rpcEncoder.hpp" #include "rpcDecoder.hpp" #include "rpcMessage.hpp" +#include "utils.hpp" #include "GeneralRPC.pb.h" #include "UserBitShared.pb.h" -#ifdef DEBUG -#define BOOST_ASIO_ENABLE_HANDLER_TRACKING -#endif - - namespace Drill{ RpcEncoder DrillClientImpl::s_encoder; RpcDecoder DrillClientImpl::s_decoder; std::string debugPrintQid(const exec::shared::QueryId& qid){ - return std::string("[")+boost::lexical_cast<std::string>(qid.part1()) +std::string(":") + boost::lexical_cast<std::string>(qid.part2())+std::string("] "); + return std::string("[")+boost::lexical_cast<std::string>(qid.part1()) +std::string(":") + boost::lexical_cast<std::string>(qid.part2())+std::string("] "); } -void DrillClientImpl::parseConnectStr(const char* connectStr, std::string& protocol, std::string& hostPortStr){ - char u[1024]; - strcpy(u,connectStr); +void setSocketTimeout(boost::asio::ip::tcp::socket& socket, int32_t timeout){ +#if defined _WIN32 + int32_t timeoutMsecs=timeout*1000; + setsockopt(socket.native(), SOL_SOCKET, SO_RCVTIMEO, (const char*)&timeoutMsecs, sizeof(timeoutMsecs)); + setsockopt(socket.native(), SOL_SOCKET, SO_SNDTIMEO, (const char*)&timeoutMsecs, sizeof(timeoutMsecs)); +#else + struct timeval tv; + tv.tv_sec = timeout; + tv.tv_usec = 0; + int e=0; + e=setsockopt(socket.native(), SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); + e=setsockopt(socket.native(), SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv)); +#endif +} + + +void DrillClientImpl::parseConnectStr(const char* connectStr, + std::string& pathToDrill, + std::string& protocol, + std::string& hostPortStr){ + char u[MAX_CONNECT_STR+1]; + strncpy(u,connectStr, MAX_CONNECT_STR); u[MAX_CONNECT_STR]=0; char* z=strtok(u, "="); - char* c=strtok(NULL, ""); + char* c=strtok(NULL, "/"); + char* p=strtok(NULL, ""); + + if(p!=NULL) pathToDrill=std::string("/")+p; protocol=z; hostPortStr=c; + return; } connectionStatus_t DrillClientImpl::connect(const char* connStr){ - std::string protocol, hostPortStr; - std::string host; + std::string pathToDrill, protocol, hostPortStr; + std::string host; std::string port; if(!this->m_bIsConnected){ - parseConnectStr(connStr, protocol, hostPortStr); - if(!strcmp(protocol.c_str(), "jdbc:drill:zk")){ + parseConnectStr(connStr, pathToDrill, protocol, hostPortStr); + if(!strcmp(protocol.c_str(), "zk")){ ZookeeperImpl zook; - if(zook.connectToZookeeper(hostPortStr.c_str())!=0){ + if(zook.connectToZookeeper(hostPortStr.c_str(), pathToDrill.c_str())!=0){ return handleConnError(CONN_ZOOKEEPER_ERROR, getMessage(ERR_CONN_ZOOKEEPER, zook.getError().c_str())); } zook.debugPrint(); @@ -74,9 +94,9 @@ connectionStatus_t DrillClientImpl::connect(const char* connStr){ host=boost::lexical_cast<std::string>(e.address()); port=boost::lexical_cast<std::string>(e.user_port()); zook.close(); - }else if(!strcmp(protocol.c_str(), "jdbc:drill:local")){ - char tempStr[1024]; - strcpy(tempStr, hostPortStr.c_str()); + }else if(!strcmp(protocol.c_str(), "local")){ + char tempStr[MAX_CONNECT_STR+1]; + strncpy(tempStr, hostPortStr.c_str(), MAX_CONNECT_STR); tempStr[MAX_CONNECT_STR]=0; host=strtok(tempStr, ":"); port=strtok(NULL, ""); }else{ @@ -97,7 +117,7 @@ connectionStatus_t DrillClientImpl::connect(const char* host, const char* port){ tcp::resolver::iterator end; while (iter != end){ endpoint = *iter++; - BOOST_LOG_TRIVIAL(trace) << endpoint << std::endl; + DRILL_LOG(LOG_TRACE) << endpoint << std::endl; } boost::system::error_code ec; m_socket.connect(endpoint, ec); @@ -108,59 +128,147 @@ connectionStatus_t DrillClientImpl::connect(const char* host, const char* port){ }catch(std::exception e){ return handleConnError(CONN_FAILURE, getMessage(ERR_CONN_EXCEPT, e.what())); } + + // + // We put some OS dependent code here for timing out a socket. Mostly, this appears to + // do nothing. Should we leave it in there? + // + setSocketTimeout(m_socket, DrillClientConfig::getSocketTimeout()); + return CONN_SUCCESS; } -void DrillClientImpl::sendSync(OutBoundRpcMessage& msg){ +connectionStatus_t DrillClientImpl::sendSync(OutBoundRpcMessage& msg){ DrillClientImpl::s_encoder.Encode(m_wbuf, msg); - m_socket.write_some(boost::asio::buffer(m_wbuf)); + boost::system::error_code ec; + size_t s=m_socket.write_some(boost::asio::buffer(m_wbuf), ec); + if(!ec && s!=0){ + return CONN_SUCCESS; + }else{ + return handleConnError(CONN_FAILURE, getMessage(ERR_CONN_WFAIL, ec.message().c_str())); + } } -void DrillClientImpl::recvSync(InBoundRpcMessage& msg){ - m_socket.read_some(boost::asio::buffer(m_rbuf)); - uint32_t length = 0; - int bytes_read = DrillClientImpl::s_decoder.LengthDecode(m_rbuf.data(), &length); - DrillClientImpl::s_decoder.Decode(m_rbuf.data() + bytes_read, length, msg); +connectionStatus_t DrillClientImpl::recvHandshake(){ + if(m_rbuf==NULL){ + m_rbuf = Utils::allocateBuffer(MAX_SOCK_RD_BUFSIZE); + } + + m_deadlineTimer.expires_from_now(boost::posix_time::seconds(DrillClientConfig::getSocketTimeout())); + m_deadlineTimer.async_wait(boost::bind( + &DrillClientImpl::handleHShakeReadTimeout, + this, + boost::asio::placeholders::error + )); + DRILL_LOG(LOG_TRACE) << "Started new handshake wait timer." << std::endl; + + async_read( + this->m_socket, + boost::asio::buffer(m_rbuf, LEN_PREFIX_BUFLEN), + boost::bind( + &DrillClientImpl::handleHandshake, + this, + m_rbuf, + boost::asio::placeholders::error, + boost::asio::placeholders::bytes_transferred) + ); + DRILL_LOG(LOG_DEBUG) << "Sent handshake read request to server" << std::endl; + m_io_service.run(); + if(m_rbuf!=NULL){ + Utils::freeBuffer(m_rbuf); m_rbuf=NULL; + } + return CONN_SUCCESS; } -bool DrillClientImpl::ValidateHandShake(){ - exec::user::UserToBitHandshake u2b; - exec::user::BitToUserHandshake b2u; +void DrillClientImpl::handleHandshake(ByteBuf_t _buf, + const boost::system::error_code& err, + size_t bytes_transferred) { + boost::system::error_code error=err; + // cancel the timer + m_deadlineTimer.cancel(); + DRILL_LOG(LOG_TRACE) << "Deadline timer cancelled." << std::endl; + if(!error){ + InBoundRpcMessage msg; + uint32_t length = 0; + int bytes_read = DrillClientImpl::s_decoder.LengthDecode(m_rbuf, &length); + if(length>0){ + size_t leftover = LEN_PREFIX_BUFLEN - bytes_read; + ByteBuf_t b=m_rbuf + LEN_PREFIX_BUFLEN; + size_t bytesToRead=length - leftover; + while(1){ + size_t dataBytesRead=m_socket.read_some( + boost::asio::buffer(b, bytesToRead), + error); + if(err) break; + DRILL_LOG(LOG_TRACE) << "Handshake Message: actual bytes read = " << dataBytesRead << std::endl; + if(dataBytesRead==bytesToRead) break; + bytesToRead-=dataBytesRead; + b+=dataBytesRead; + } + DrillClientImpl::s_decoder.Decode(m_rbuf+bytes_read, length, msg); + }else{ + handleConnError(CONN_FAILURE, getMessage(ERR_CONN_RDFAIL, "No handshake")); + } + exec::user::BitToUserHandshake b2u; + b2u.ParseFromArray(msg.m_pbody.data(), msg.m_pbody.size()); + this->m_handshakeVersion=b2u.rpc_version(); + + }else{ + // boost error + handleConnError(CONN_FAILURE, getMessage(ERR_CONN_RDFAIL, error.message().c_str())); + return; + } + return; +} +void DrillClientImpl::handleHShakeReadTimeout(const boost::system::error_code & err){ + // if err == boost::asio::error::operation_aborted) then the caller cancelled the timer. + if(!err){ + // Check whether the deadline has passed. + if (m_deadlineTimer.expires_at() <= boost::asio::deadline_timer::traits_type::now()){ + // The deadline has passed. + m_deadlineTimer.expires_at(boost::posix_time::pos_infin); + DRILL_LOG(LOG_TRACE) << "Deadline timer expired." << std::endl; + m_socket.close(); + } + } + return; +} + +bool DrillClientImpl::validateHandShake(){ + exec::user::UserToBitHandshake u2b; u2b.set_channel(exec::shared::USER); - u2b.set_rpc_version(1); + u2b.set_rpc_version(DRILL_RPC_VERSION); u2b.set_support_listening(true); - { boost::lock_guard<boost::mutex> lock(this->m_dcMutex); uint64_t coordId = this->getNextCoordinationId(); OutBoundRpcMessage out_msg(exec::rpc::REQUEST, exec::user::HANDSHAKE, coordId, &u2b); sendSync(out_msg); - - InBoundRpcMessage in_msg; - recvSync(in_msg); - - b2u.ParseFromArray(in_msg.m_pbody.data(), in_msg.m_pbody.size()); } - // validate handshake - if (b2u.rpc_version() != u2b.rpc_version()) { - BOOST_LOG_TRIVIAL(trace) << "Invalid rpc version. Expected << " - << u2b.rpc_version() << ", actual "<< b2u.rpc_version() << "." ; - handleConnError(CONN_HANDSHAKE_FAILED, - getMessage(ERR_CONN_NOHSHAKE, u2b.rpc_version(), b2u.rpc_version())); + recvHandshake(); + this->m_io_service.reset(); + if(this->m_pError!=NULL){ + return false; + } + if(m_handshakeVersion != u2b.rpc_version()) { + DRILL_LOG(LOG_TRACE) << "Invalid rpc version. Expected << " + << DRILL_RPC_VERSION << ", actual "<< m_handshakeVersion << "." << std::endl; + handleConnError(CONN_HANDSHAKE_FAILED, + getMessage(ERR_CONN_NOHSHAKE, DRILL_RPC_VERSION, m_handshakeVersion)); return false; } return true; } -std::vector<Drill::FieldMetadata*> DrillClientQueryResult::s_emptyColDefs; +FieldDefPtr DrillClientQueryResult::s_emptyColDefs( new (std::vector<Drill::FieldMetadata*>)); -DrillClientQueryResult* DrillClientImpl::SubmitQuery(exec::user::QueryType t, - const std::string& plan, - pfnQueryResultsListener l, +DrillClientQueryResult* DrillClientImpl::SubmitQuery(::exec::shared::QueryType t, + const std::string& plan, + pfnQueryResultsListener l, void* lCtx){ exec::user::RunQuery query; query.set_results_mode(exec::user::STREAM_FULL); @@ -180,16 +288,16 @@ DrillClientQueryResult* DrillClientImpl::SubmitQuery(exec::user::QueryType t, bool sendRequest=false; this->m_queryIds[coordId]=pQuery; - BOOST_LOG_TRIVIAL(debug) << "Submit Query Request. Coordination id = " << coordId; + DRILL_LOG(LOG_DEBUG) << "Submit Query Request. Coordination id = " << coordId << std::endl; if(m_pendingRequests++==0){ sendRequest=true; }else{ - BOOST_LOG_TRIVIAL(debug) << "Queueing read request to server" << std::endl; - BOOST_LOG_TRIVIAL(debug) << "Number of pending requests = " << m_pendingRequests << std::endl; + DRILL_LOG(LOG_DEBUG) << "Queueing read request to server" << std::endl; + DRILL_LOG(LOG_DEBUG) << "Number of pending requests = " << m_pendingRequests << std::endl; } if(sendRequest){ - BOOST_LOG_TRIVIAL(debug) << "Sending read request. Number of pending requests = " + DRILL_LOG(LOG_DEBUG) << "Sending read request. Number of pending requests = " << m_pendingRequests << std::endl; getNextResult(); // async wait for results } @@ -198,8 +306,8 @@ DrillClientQueryResult* DrillClientImpl::SubmitQuery(exec::user::QueryType t, //run this in a new thread { if(this->m_pListenerThread==NULL){ - BOOST_LOG_TRIVIAL(debug) << "Starting listener thread." << std::endl; - this->m_pListenerThread= new boost::thread(boost::bind(&boost::asio::io_service::run, + DRILL_LOG(LOG_DEBUG) << "Starting listener thread." << std::endl; + this->m_pListenerThread= new boost::thread(boost::bind(&boost::asio::io_service::run, &this->m_io_service)); } } @@ -211,61 +319,72 @@ void DrillClientImpl::getNextResult(){ // This call is always made from within a function where the mutex has already been acquired //boost::lock_guard<boost::mutex> lock(this->m_dcMutex); - //use free, not delete to free - ByteBuf_t readBuf = allocateBuffer(LEN_PREFIX_BUFLEN); - async_read( + //use free, not delete to free + ByteBuf_t readBuf = Utils::allocateBuffer(LEN_PREFIX_BUFLEN); + + m_deadlineTimer.expires_from_now(boost::posix_time::seconds(DrillClientConfig::getSocketTimeout())); + m_deadlineTimer.async_wait(boost::bind( + &DrillClientImpl::handleReadTimeout, + this, + boost::asio::placeholders::error + )); + DRILL_LOG(LOG_TRACE) << "Started new async wait timer." << std::endl; + + async_read( this->m_socket, boost::asio::buffer(readBuf, LEN_PREFIX_BUFLEN), boost::bind( &DrillClientImpl::handleRead, this, readBuf, - boost::asio::placeholders::error, + boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred) ); - BOOST_LOG_TRIVIAL(debug) << "Sent read request to server" << std::endl; + DRILL_LOG(LOG_DEBUG) << "Sent read request to server" << std::endl; } void DrillClientImpl::waitForResults(){ this->m_pListenerThread->join(); - BOOST_LOG_TRIVIAL(debug) << "Listener thread exited." << std::endl; + DRILL_LOG(LOG_DEBUG) << "Listener thread exited." << std::endl; delete this->m_pListenerThread; this->m_pListenerThread=NULL; } -status_t DrillClientImpl::readMsg(ByteBuf_t _buf, InBoundRpcMessage& msg, boost::system::error_code& error){ +status_t DrillClientImpl::readMsg(ByteBuf_t _buf, ByteBuf_t* allocatedBuffer, InBoundRpcMessage& msg, boost::system::error_code& error){ size_t leftover=0; uint32_t rmsgLen; ByteBuf_t currentBuffer; + *allocatedBuffer=NULL; { - // We need to protect the readLength and read buffer, and the pending requests counter, + // We need to protect the readLength and read buffer, and the pending requests counter, // but we don't have to keep the lock while we decode the rest of the buffer. boost::lock_guard<boost::mutex> lock(this->m_dcMutex); int bytes_read = DrillClientImpl::s_decoder.LengthDecode(_buf, &rmsgLen); - BOOST_LOG_TRIVIAL(trace) << "len bytes = " << bytes_read << std::endl; - BOOST_LOG_TRIVIAL(trace) << "rmsgLen = " << rmsgLen << std::endl; + DRILL_LOG(LOG_TRACE) << "len bytes = " << bytes_read << std::endl; + DRILL_LOG(LOG_TRACE) << "rmsgLen = " << rmsgLen << std::endl; if(rmsgLen>0){ leftover = LEN_PREFIX_BUFLEN - bytes_read; // Allocate a buffer - BOOST_LOG_TRIVIAL(trace) << "Allocated and locked buffer." << std::endl; - currentBuffer=allocateBuffer(rmsgLen); + DRILL_LOG(LOG_TRACE) << "Allocated and locked buffer." << std::endl; + currentBuffer=Utils::allocateBuffer(rmsgLen); if(currentBuffer==NULL){ + Utils::freeBuffer(_buf); return handleQryError(QRY_CLIENT_OUTOFMEM, getMessage(ERR_QRY_OUTOFMEM), NULL); } + *allocatedBuffer=currentBuffer; if(leftover){ memcpy(currentBuffer, _buf + bytes_read, leftover); } - freeBuffer(_buf); - BOOST_LOG_TRIVIAL(trace) << "reading data (rmsgLen - leftover) : " + DRILL_LOG(LOG_TRACE) << "reading data (rmsgLen - leftover) : " << (rmsgLen - leftover) << std::endl; ByteBuf_t b=currentBuffer + leftover; size_t bytesToRead=rmsgLen - leftover; while(1){ size_t dataBytesRead=this->m_socket.read_some( - boost::asio::buffer(b, bytesToRead), + boost::asio::buffer(b, bytesToRead), error); if(error) break; - BOOST_LOG_TRIVIAL(trace) << "Data Message: actual bytes read = " << dataBytesRead << std::endl; + DRILL_LOG(LOG_TRACE) << "Data Message: actual bytes read = " << dataBytesRead << std::endl; if(dataBytesRead==bytesToRead) break; bytesToRead-=dataBytesRead; b+=dataBytesRead; @@ -273,31 +392,34 @@ status_t DrillClientImpl::readMsg(ByteBuf_t _buf, InBoundRpcMessage& msg, boost: if(!error){ // read data successfully DrillClientImpl::s_decoder.Decode(currentBuffer, rmsgLen, msg); - BOOST_LOG_TRIVIAL(trace) << "Done decoding chunk. Coordination id: " <<msg.m_coord_id<< std::endl; + DRILL_LOG(LOG_TRACE) << "Done decoding chunk. Coordination id: " <<msg.m_coord_id<< std::endl; }else{ - return handleQryError(QRY_COMM_ERROR, + Utils::freeBuffer(_buf); + return handleQryError(QRY_COMM_ERROR, getMessage(ERR_QRY_COMMERR, error.message().c_str()), NULL); } }else{ - // got a message with an invalid read length. + // got a message with an invalid read length. + Utils::freeBuffer(_buf); return handleQryError(QRY_INTERNAL_ERROR, getMessage(ERR_QRY_INVREADLEN), NULL); } } + Utils::freeBuffer(_buf); return QRY_SUCCESS; } -status_t DrillClientImpl::processQueryResult(InBoundRpcMessage& msg ){ +status_t DrillClientImpl::processQueryResult(ByteBuf_t allocatedBuffer, InBoundRpcMessage& msg ){ DrillClientQueryResult* pDrillClientQueryResult=NULL; status_t ret=QRY_SUCCESS; { boost::lock_guard<boost::mutex> lock(this->m_dcMutex); exec::user::QueryResult* qr = new exec::user::QueryResult; //Record Batch will own this object and free it up. - BOOST_LOG_TRIVIAL(debug) << "Processing Query Result " << std::endl; + DRILL_LOG(LOG_DEBUG) << "Processing Query Result " << std::endl; qr->ParseFromArray(msg.m_pbody.data(), msg.m_pbody.size()); - BOOST_LOG_TRIVIAL(trace) << qr->DebugString(); + DRILL_LOG(LOG_TRACE) << qr->DebugString() << std::endl; - BOOST_LOG_TRIVIAL(debug) << "Searching for Query Id - " << debugPrintQid(qr->query_id()) << std::endl; + DRILL_LOG(LOG_DEBUG) << "Searching for Query Id - " << debugPrintQid(qr->query_id()) << std::endl; exec::shared::QueryId qid; qid.CopyFrom(qr->query_id()); @@ -306,39 +428,48 @@ status_t DrillClientImpl::processQueryResult(InBoundRpcMessage& msg ){ if(it!=this->m_queryResults.end()){ pDrillClientQueryResult=(*it).second; }else{ - assert(0); + assert(0); //assert might be compiled away in a release build. So return an error to the app. status_t ret= handleQryError(QRY_INTERNAL_ERROR, getMessage(ERR_QRY_OUTOFORDER), NULL); delete qr; return ret; } - BOOST_LOG_TRIVIAL(debug) << "Drill Client Query Result Query Id - " << - debugPrintQid(*pDrillClientQueryResult->m_pQueryId) + DRILL_LOG(LOG_DEBUG) << "Drill Client Query Result Query Id - " << + debugPrintQid(*pDrillClientQueryResult->m_pQueryId) << std::endl; //Check QueryResult.queryState. QueryResult could have an error. if(qr->query_state() == exec::user::QueryResult_QueryState_FAILED){ status_t ret=handleQryError(QRY_FAILURE, qr->error(0), pDrillClientQueryResult); + Utils::freeBuffer(allocatedBuffer); delete qr; return ret; } //Validate the RPC message std::string valErr; if( (ret=validateMessage(msg, *qr, valErr)) != QRY_SUCCESS){ + Utils::freeBuffer(allocatedBuffer); + delete qr; return handleQryError(ret, getMessage(ERR_QRY_INVRPC, valErr.c_str()), pDrillClientQueryResult); } - //Build Record Batch here - BOOST_LOG_TRIVIAL(trace) << qr->DebugString(); + //Build Record Batch here + DRILL_LOG(LOG_TRACE) << qr->DebugString() << std::endl; + + RecordBatch* pRecordBatch= new RecordBatch(qr, allocatedBuffer, msg.m_dbody); + pDrillClientQueryResult->m_numBatches++; - RecordBatch* pRecordBatch= new RecordBatch(qr, msg.m_dbody); + DRILL_LOG(LOG_TRACE) << "Allocated new Record batch." << (void*)pRecordBatch << std::endl; pRecordBatch->build(); - BOOST_LOG_TRIVIAL(debug) << debugPrintQid(qr->query_id())<<"recordBatch.numRecords " + DRILL_LOG(LOG_DEBUG) << debugPrintQid(qr->query_id())<<"recordBatch.numRecords " << pRecordBatch->getNumRecords() << std::endl; - BOOST_LOG_TRIVIAL(debug) << debugPrintQid(qr->query_id())<<"recordBatch.numFields " + DRILL_LOG(LOG_DEBUG) << debugPrintQid(qr->query_id())<<"recordBatch.numFields " << pRecordBatch->getNumFields() << std::endl; - BOOST_LOG_TRIVIAL(debug) << debugPrintQid(qr->query_id())<<"recordBatch.isLastChunk " + DRILL_LOG(LOG_DEBUG) << debugPrintQid(qr->query_id())<<"recordBatch.isLastChunk " << pRecordBatch->isLastChunk() << std::endl; + ret=pDrillClientQueryResult->setupColumnDefs(qr); + if(ret==QRY_SUCCESS_WITH_INFO)pRecordBatch->schemaChanged(true); + pDrillClientQueryResult->m_bIsQueryPending=true; pDrillClientQueryResult->m_bIsLastChunk=qr->is_last_chunk(); pfnQueryResultsListener pResultsListener=pDrillClientQueryResult->m_pResultsListener; @@ -346,7 +477,7 @@ status_t DrillClientImpl::processQueryResult(InBoundRpcMessage& msg ){ ret = pResultsListener(pDrillClientQueryResult, pRecordBatch, NULL); }else{ //Use a default callback that is called when a record batch is received - ret = pDrillClientQueryResult->defaultQueryResultsListener(pDrillClientQueryResult, + ret = pDrillClientQueryResult->defaultQueryResultsListener(pDrillClientQueryResult, pRecordBatch, NULL); } } // release lock @@ -357,16 +488,16 @@ status_t DrillClientImpl::processQueryResult(InBoundRpcMessage& msg ){ m_pendingRequests--; } pDrillClientQueryResult->m_bIsQueryPending=false; - BOOST_LOG_TRIVIAL(debug) << "Client app cancelled query."; + DRILL_LOG(LOG_DEBUG) << "Client app cancelled query." << std::endl; return ret; } if(pDrillClientQueryResult->m_bIsLastChunk){ { boost::lock_guard<boost::mutex> lock(this->m_dcMutex); m_pendingRequests--; - BOOST_LOG_TRIVIAL(debug) << debugPrintQid(*pDrillClientQueryResult->m_pQueryId) + DRILL_LOG(LOG_DEBUG) << debugPrintQid(*pDrillClientQueryResult->m_pQueryId) << "Received last batch. " << std::endl; - BOOST_LOG_TRIVIAL(debug) << debugPrintQid(*pDrillClientQueryResult->m_pQueryId) + DRILL_LOG(LOG_DEBUG) << debugPrintQid(*pDrillClientQueryResult->m_pQueryId) << "Pending requests: " << m_pendingRequests <<"." << std::endl; } ret=QRY_NO_MORE_DATA; @@ -377,9 +508,9 @@ status_t DrillClientImpl::processQueryResult(InBoundRpcMessage& msg ){ return ret; } -status_t DrillClientImpl::processQueryId(InBoundRpcMessage& msg ){ +status_t DrillClientImpl::processQueryId(ByteBuf_t allocatedBuffer, InBoundRpcMessage& msg ){ DrillClientQueryResult* pDrillClientQueryResult=NULL; - BOOST_LOG_TRIVIAL(debug) << "Processing Query Handle with coordination id:" << msg.m_coord_id << std::endl; + DRILL_LOG(LOG_DEBUG) << "Processing Query Handle with coordination id:" << msg.m_coord_id << std::endl; status_t ret=QRY_SUCCESS; boost::lock_guard<boost::mutex> lock(m_dcMutex); @@ -388,45 +519,74 @@ status_t DrillClientImpl::processQueryId(InBoundRpcMessage& msg ){ if(it!=this->m_queryIds.end()){ pDrillClientQueryResult=(*it).second; exec::shared::QueryId *qid = new exec::shared::QueryId; - BOOST_LOG_TRIVIAL(trace) << "Received Query Handle" << msg.m_pbody.size(); + DRILL_LOG(LOG_TRACE) << "Received Query Handle" << msg.m_pbody.size() << std::endl; qid->ParseFromArray(msg.m_pbody.data(), msg.m_pbody.size()); - BOOST_LOG_TRIVIAL(trace) << qid->DebugString(); + DRILL_LOG(LOG_TRACE) << qid->DebugString() << std::endl; m_queryResults[qid]=pDrillClientQueryResult; //save queryId allocated here so we can free it later pDrillClientQueryResult->setQueryId(qid); }else{ + Utils::freeBuffer(allocatedBuffer); return handleQryError(QRY_INTERNAL_ERROR, getMessage(ERR_QRY_INVQUERYID), NULL); } + Utils::freeBuffer(allocatedBuffer); return ret; } -void DrillClientImpl::handleRead(ByteBuf_t _buf, - const boost::system::error_code& err, +void DrillClientImpl::handleReadTimeout(const boost::system::error_code & err){ + // if err == boost::asio::error::operation_aborted) then the caller cancelled the timer. + if(!err){ + // Check whether the deadline has passed. + if (m_deadlineTimer.expires_at() <= boost::asio::deadline_timer::traits_type::now()){ + // The deadline has passed. + handleQryError(QRY_COMM_ERROR, getMessage(ERR_QRY_TIMOUT), NULL); + // There is no longer an active deadline. The expiry is set to positive + // infinity so that the timer never expires until a new deadline is set. + // Note that at this time, the caller is not in a (async) wait for the timer. + m_deadlineTimer.expires_at(boost::posix_time::pos_infin); + DRILL_LOG(LOG_TRACE) << "Deadline timer expired." << std::endl; + // Cancel all pending async IOs. + // The cancel call _MAY_ not work on all platforms. To be a little more reliable we need + // to have the BOOST_ASIO_ENABLE_CANCELIO macro (as well as the BOOST_ASIO_DISABLE_IOCP macro?) + // defined. To be really sure, we need to close the socket. Closing the socket is a bit + // drastic and we will defer that till a later release. + m_socket.cancel(); + } + } + return; +} + +void DrillClientImpl::handleRead(ByteBuf_t _buf, + const boost::system::error_code& err, size_t bytes_transferred) { boost::system::error_code error=err; + // cancel the timer + m_deadlineTimer.cancel(); + DRILL_LOG(LOG_TRACE) << "Deadline timer cancelled." << std::endl; if(!error){ InBoundRpcMessage msg; - BOOST_LOG_TRIVIAL(trace) << "Getting new message" << std::endl; + DRILL_LOG(LOG_TRACE) << "Getting new message" << std::endl; + ByteBuf_t allocatedBuffer=NULL; - if(readMsg(_buf, msg, error)!=QRY_SUCCESS){ + if(readMsg(_buf, &allocatedBuffer, msg, error)!=QRY_SUCCESS){ if(m_pendingRequests!=0){ boost::lock_guard<boost::mutex> lock(this->m_dcMutex); getNextResult(); } return; - } + } if(!error && msg.m_rpc_type==exec::user::QUERY_RESULT){ - if(processQueryResult(msg)!=QRY_SUCCESS){ + if(processQueryResult(allocatedBuffer, msg)!=QRY_SUCCESS){ if(m_pendingRequests!=0){ boost::lock_guard<boost::mutex> lock(this->m_dcMutex); getNextResult(); } return; } - }else if(!error && msg.m_rpc_type==exec::user::QUERY_HANDLE){ - if(processQueryId(msg)!=QRY_SUCCESS){ + }else if(!error && msg.m_rpc_type==exec::user::QUERY_HANDLE){ + if(processQueryId(allocatedBuffer, msg)!=QRY_SUCCESS){ if(m_pendingRequests!=0){ boost::lock_guard<boost::mutex> lock(this->m_dcMutex); getNextResult(); @@ -436,15 +596,15 @@ void DrillClientImpl::handleRead(ByteBuf_t _buf, }else{ boost::lock_guard<boost::mutex> lock(this->m_dcMutex); if(error){ - // We have a socket read error, but we do not know which query this is for. + // We have a socket read error, but we do not know which query this is for. // Signal ALL pending queries that they should stop waiting. - BOOST_LOG_TRIVIAL(trace) << "read error: " << error << "\n"; + DRILL_LOG(LOG_TRACE) << "read error: " << error << std::endl; handleQryError(QRY_COMM_ERROR, getMessage(ERR_QRY_COMMERR, error.message().c_str()), NULL); return; }else{ //If not QUERY_RESULT, then we think something serious has gone wrong? assert(0); - BOOST_LOG_TRIVIAL(trace) << "QueryResult returned " << msg.m_rpc_type; + DRILL_LOG(LOG_TRACE) << "QueryResult returned " << msg.m_rpc_type << std::endl; handleQryError(QRY_INTERNAL_ERROR, getMessage(ERR_QRY_INVRPCTYPE, msg.m_rpc_type), NULL); return; } @@ -455,6 +615,7 @@ void DrillClientImpl::handleRead(ByteBuf_t _buf, } }else{ // boost error + Utils::freeBuffer(_buf); boost::lock_guard<boost::mutex> lock(this->m_dcMutex); handleQryError(QRY_COMM_ERROR, getMessage(ERR_QRY_COMMERR, error.message().c_str()), NULL); return; @@ -485,6 +646,7 @@ status_t DrillClientImpl::validateMessage(InBoundRpcMessage& msg, exec::user::Qu connectionStatus_t DrillClientImpl::handleConnError(connectionStatus_t status, std::string msg){ DrillClientError* pErr = new DrillClientError(status, DrillClientError::CONN_ERROR_START+status, msg); m_pendingRequests=0; + if(m_pError!=NULL){ delete m_pError; m_pError=NULL;} m_pError=pErr; broadcastError(this->m_pError); return status; @@ -492,19 +654,20 @@ connectionStatus_t DrillClientImpl::handleConnError(connectionStatus_t status, s status_t DrillClientImpl::handleQryError(status_t status, std::string msg, DrillClientQueryResult* pQueryResult){ DrillClientError* pErr = new DrillClientError(status, DrillClientError::QRY_ERROR_START+status, msg); + if(m_pError!=NULL){ delete m_pError; m_pError=NULL;} + m_pError=pErr; if(pQueryResult!=NULL){ m_pendingRequests--; pQueryResult->signalError(pErr); }else{ m_pendingRequests=0; - m_pError=pErr; broadcastError(this->m_pError); } return status; } -status_t DrillClientImpl::handleQryError(status_t status, - const exec::shared::DrillPBError& e, +status_t DrillClientImpl::handleQryError(status_t status, + const exec::shared::DrillPBError& e, DrillClientQueryResult* pQueryResult){ assert(pQueryResult!=NULL); this->m_pError = DrillClientError::getErrorObject(e); @@ -516,8 +679,10 @@ status_t DrillClientImpl::handleQryError(status_t status, void DrillClientImpl::broadcastError(DrillClientError* pErr){ if(pErr!=NULL){ std::map<int, DrillClientQueryResult*>::iterator iter; - for(iter = m_queryIds.begin(); iter != m_queryIds.end(); iter++) { - iter->second->signalError(pErr); + if(!m_queryIds.empty()){ + for(iter = m_queryIds.begin(); iter != m_queryIds.end(); iter++) { + iter->second->signalError(pErr); + } } } return; @@ -526,17 +691,21 @@ void DrillClientImpl::broadcastError(DrillClientError* pErr){ void DrillClientImpl::clearMapEntries(DrillClientQueryResult* pQueryResult){ std::map<int, DrillClientQueryResult*>::iterator iter; boost::lock_guard<boost::mutex> lock(m_dcMutex); - for(iter=m_queryIds.begin(); iter!=m_queryIds.end(); iter++) { - if(pQueryResult==(DrillClientQueryResult*)iter->second){ - m_queryIds.erase(iter->first); - break; + if(!m_queryIds.empty()){ + for(iter=m_queryIds.begin(); iter!=m_queryIds.end(); iter++) { + if(pQueryResult==(DrillClientQueryResult*)iter->second){ + m_queryIds.erase(iter->first); + break; + } } } - std::map<exec::shared::QueryId*, DrillClientQueryResult*, compareQueryId>::iterator it; - for(it=m_queryResults.begin(); it!=m_queryResults.end(); it++) { - if(pQueryResult==(DrillClientQueryResult*)it->second){ - m_queryResults.erase(it->first); - break; + if(!m_queryResults.empty()){ + std::map<exec::shared::QueryId*, DrillClientQueryResult*, compareQueryId>::iterator it; + for(it=m_queryResults.begin(); it!=m_queryResults.end(); it++) { + if(pQueryResult==(DrillClientQueryResult*)it->second){ + m_queryResults.erase(it->first); + break; + } } } } @@ -547,7 +716,7 @@ void DrillClientImpl::sendAck(InBoundRpcMessage& msg){ OutBoundRpcMessage ack_msg(exec::rpc::RESPONSE, exec::user::ACK, msg.m_coord_id, &ack); boost::lock_guard<boost::mutex> lock(m_dcMutex); sendSync(ack_msg); - BOOST_LOG_TRIVIAL(trace) << "ACK sent" << std::endl; + DRILL_LOG(LOG_TRACE) << "ACK sent" << std::endl; } void DrillClientImpl::sendCancel(InBoundRpcMessage& msg){ @@ -556,34 +725,36 @@ void DrillClientImpl::sendCancel(InBoundRpcMessage& msg){ OutBoundRpcMessage ack_msg(exec::rpc::RESPONSE, exec::user::CANCEL_QUERY, msg.m_coord_id, &ack); boost::lock_guard<boost::mutex> lock(m_dcMutex); sendSync(ack_msg); - BOOST_LOG_TRIVIAL(trace) << "CANCEL sent" << std::endl; + DRILL_LOG(LOG_TRACE) << "CANCEL sent" << std::endl; } -// This COPIES the FieldMetadata definition for the record batch. ColumnDefs held by this +// This COPIES the FieldMetadata definition for the record batch. ColumnDefs held by this // class are used by the async callbacks. status_t DrillClientQueryResult::setupColumnDefs(exec::user::QueryResult* pQueryResult) { bool hasSchemaChanged=false; + bool isFirstIter=false; boost::lock_guard<boost::mutex> schLock(this->m_schemaMutex); - std::vector<Drill::FieldMetadata*> prevSchema=this->m_columnDefs; + FieldDefPtr prevSchema=this->m_columnDefs; + isFirstIter=this->m_numBatches==1?true:false; std::map<std::string, Drill::FieldMetadata*> oldSchema; - for(std::vector<Drill::FieldMetadata*>::iterator it = prevSchema.begin(); it != prevSchema.end(); ++it){ - // the key is the field_name + type - char type[256]; - sprintf(type, ":%d:%d",(*it)->getMinorType(), (*it)->getDataMode() ); - std::string k= (*it)->getName()+type; - oldSchema[k]=*it; + if(!m_columnDefs->empty()){ + for(std::vector<Drill::FieldMetadata*>::iterator it = prevSchema->begin(); it != prevSchema->end(); ++it){ + // the key is the field_name + type + char type[256]; + sprintf(type, ":%d:%d",(*it)->getMinorType(), (*it)->getDataMode() ); + std::string k= (*it)->getName()+type; + oldSchema[k]=*it; + } } - - m_columnDefs.clear(); + m_columnDefs->clear(); size_t numFields=pQueryResult->def().field_size(); for(size_t i=0; i<numFields; i++){ - //TODO: free this?? Drill::FieldMetadata* fmd= new Drill::FieldMetadata; fmd->set(pQueryResult->def().field(i)); - this->m_columnDefs.push_back(fmd); + this->m_columnDefs->push_back(fmd); - //Look for changes in the vector and trigger a Schema change event if necessary. + //Look for changes in the vector and trigger a Schema change event if necessary. //If vectors are different, then call the schema change listener. char type[256]; sprintf(type, ":%d:%d",fmd->getMinorType(), fmd->getDataMode() ); @@ -601,22 +772,27 @@ status_t DrillClientQueryResult::setupColumnDefs(exec::user::QueryResult* pQuery } //free memory allocated for FieldMetadata objects saved in previous columnDefs; - for(std::vector<Drill::FieldMetadata*>::iterator it = prevSchema.begin(); it != prevSchema.end(); ++it){ - delete *it; + if(!prevSchema->empty()){ + for(std::vector<Drill::FieldMetadata*>::iterator it = prevSchema->begin(); it != prevSchema->end(); ++it){ + delete *it; + } } - prevSchema.clear(); - this->m_bHasSchemaChanged=hasSchemaChanged; - if(hasSchemaChanged){ - //TODO: invoke schema change Listener + prevSchema->clear(); + this->m_bHasSchemaChanged=hasSchemaChanged&&!isFirstIter; + if(this->m_bHasSchemaChanged){ + //invoke schema change Listener + if(m_pSchemaListener!=NULL){ + m_pSchemaListener(this, m_columnDefs, NULL); + } } - return hasSchemaChanged?QRY_SUCCESS_WITH_INFO:QRY_SUCCESS; + return this->m_bHasSchemaChanged?QRY_SUCCESS_WITH_INFO:QRY_SUCCESS; } -status_t DrillClientQueryResult::defaultQueryResultsListener(void* ctx, - RecordBatch* b, +status_t DrillClientQueryResult::defaultQueryResultsListener(void* ctx, + RecordBatch* b, DrillClientError* err) { //ctx; // unused, we already have the this pointer - BOOST_LOG_TRIVIAL(trace) << "Query result listener called" << std::endl; + DRILL_LOG(LOG_TRACE) << "Query result listener called" << std::endl; //check if the query has been canceled. IF so then return FAILURE. Caller will send cancel to the server. if(this->m_bCancel){ return QRY_FAILURE; @@ -625,7 +801,7 @@ status_t DrillClientQueryResult::defaultQueryResultsListener(void* ctx, // signal the cond var { #ifdef DEBUG - BOOST_LOG_TRIVIAL(debug)<<debugPrintQid(b->getQueryResult()->query_id()) + DRILL_LOG(LOG_DEBUG)<<debugPrintQid(b->getQueryResult()->query_id()) << "Query result listener saved result to queue." << std::endl; #endif boost::lock_guard<boost::mutex> cvLock(this->m_cvMutex); @@ -644,7 +820,7 @@ RecordBatch* DrillClientQueryResult::peekNext() { //if no more data, return NULL; if(!m_bIsQueryPending) return NULL; boost::unique_lock<boost::mutex> cvLock(this->m_cvMutex); - BOOST_LOG_TRIVIAL(trace) << "Synchronous read waiting for data." << std::endl; + DRILL_LOG(LOG_TRACE) << "Synchronous read waiting for data." << std::endl; while(!this->m_bHasData && !m_bHasError) { this->m_cv.wait(cvLock); } @@ -656,11 +832,17 @@ RecordBatch* DrillClientQueryResult::peekNext() { RecordBatch* DrillClientQueryResult::getNext() { RecordBatch* pRecordBatch=NULL; //if no more data, return NULL; - if(!m_bIsQueryPending) return NULL; + if(!m_bIsQueryPending){ + DRILL_LOG(LOG_TRACE) << "Query is done." << std::endl; + if(!m_recordBatches.empty()){ + DRILL_LOG(LOG_TRACE) << " But there is a Record batch left behind." << std::endl; + } + return NULL; + } boost::unique_lock<boost::mutex> cvLock(this->m_cvMutex); - BOOST_LOG_TRIVIAL(trace) << "Synchronous read waiting for data." << std::endl; - while(!this->m_bHasData && !m_bHasError) { + DRILL_LOG(LOG_TRACE) << "Synchronous read waiting for data." << std::endl; + while(!this->m_bHasData && !m_bHasError){ this->m_cv.wait(cvLock); } // remove first element from queue @@ -709,33 +891,49 @@ void DrillClientQueryResult::signalError(DrillClientError* pErr){ } void DrillClientQueryResult::clearAndDestroy(){ - if(this->m_pQueryId!=NULL){ - delete this->m_pQueryId; this->m_pQueryId=NULL; - } //free memory allocated for FieldMetadata objects saved in m_columnDefs; - for(std::vector<Drill::FieldMetadata*>::iterator it = m_columnDefs.begin(); it != m_columnDefs.end(); ++it){ - delete *it; + if(!m_columnDefs->empty()){ + for(std::vector<Drill::FieldMetadata*>::iterator it = m_columnDefs->begin(); it != m_columnDefs->end(); ++it){ + delete *it; + } + m_columnDefs->clear(); } - m_columnDefs.clear(); //Tell the parent to remove this from it's lists m_pClient->clearMapEntries(this); + + //clear query id map entries. + if(this->m_pQueryId!=NULL){ + delete this->m_pQueryId; this->m_pQueryId=NULL; + } + if(!m_recordBatches.empty()){ + // When multiple qwueries execute in parallel we sometimes get an empty record batch back from the servrer _after_ + // the last chunk has been received. We eventually delete it. + DRILL_LOG(LOG_TRACE) << "Freeing Record batch(es) left behind "<< std::endl; + RecordBatch* pR=NULL; + while(!m_recordBatches.empty()){ + pR=m_recordBatches.front(); + m_recordBatches.pop(); + delete pR; + } + } } -char ZookeeperImpl::s_drillRoot[]="/drill/drillbits1"; +char ZookeeperImpl::s_drillRoot[]="/drill/"; +char ZookeeperImpl::s_defaultCluster[]="drillbits1"; -ZookeeperImpl::ZookeeperImpl(){ +ZookeeperImpl::ZookeeperImpl(){ m_pDrillbits=new String_vector; srand (time(NULL)); m_bConnecting=true; memset(&m_id, 0, sizeof(m_id)); } -ZookeeperImpl::~ZookeeperImpl(){ +ZookeeperImpl::~ZookeeperImpl(){ delete m_pDrillbits; } ZooLogLevel ZookeeperImpl::getZkLogLevel(){ - //typedef enum {ZOO_LOG_LEVEL_ERROR=1, + //typedef enum {ZOO_LOG_LEVEL_ERROR=1, // ZOO_LOG_LEVEL_WARN=2, // ZOO_LOG_LEVEL_INFO=3, // ZOO_LOG_LEVEL_DEBUG=4 @@ -752,11 +950,11 @@ ZooLogLevel ZookeeperImpl::getZkLogLevel(){ case LOG_FATAL: default: return ZOO_LOG_LEVEL_ERROR; - } + } return ZOO_LOG_LEVEL_ERROR; } -int ZookeeperImpl::connectToZookeeper(const char* connectStr){ +int ZookeeperImpl::connectToZookeeper(const char* connectStr, const char* pathToDrill){ uint32_t waitTime=30000; // 10 seconds zoo_set_debug_level(getZkLogLevel()); zoo_deterministic_conn_order(1); // enable deterministic order @@ -780,24 +978,31 @@ int ZookeeperImpl::connectToZookeeper(const char* connectStr){ return CONN_FAILURE; } int rc = ZOK; - rc=zoo_get_children(m_zh, (char*)s_drillRoot, 0, m_pDrillbits); + char rootDir[MAX_CONNECT_STR+1]; + if(pathToDrill==NULL || strlen(pathToDrill)==0){ + strcpy(rootDir, (char*)s_drillRoot); + strcat(rootDir, s_defaultCluster); + }else{ + strncpy(rootDir, pathToDrill, MAX_CONNECT_STR); rootDir[MAX_CONNECT_STR]=0; + } + rc=zoo_get_children(m_zh, (char*)rootDir, 0, m_pDrillbits); if(rc!=ZOK){ m_err=getMessage(ERR_CONN_ZKERR, rc); zookeeper_close(m_zh); return -1; } - //Let's pick a random drillbit. if(m_pDrillbits && m_pDrillbits->count >0){ int r=rand()%(this->m_pDrillbits->count); assert(r<this->m_pDrillbits->count); char * bit=this->m_pDrillbits->data[r]; std::string s; - s=s_drillRoot + std::string("/") + bit; - int buffer_len=1024; - char buffer[1024]; + s=rootDir + std::string("/") + bit; + int buffer_len=MAX_CONNECT_STR; + char buffer[MAX_CONNECT_STR+1]; struct Stat stat; + buffer[MAX_CONNECT_STR]=0; rc= zoo_get(m_zh, s.c_str(), 0, buffer, &buffer_len, &stat); if(rc!=ZOK){ m_err=getMessage(ERR_CONN_ZKDBITERR, rc); @@ -840,7 +1045,7 @@ void ZookeeperImpl::watcher(zhandle_t *zzh, int type, int state, const char *pat // signal the cond var { if (state == ZOO_CONNECTED_STATE){ - BOOST_LOG_TRIVIAL(trace) << "Connected to Zookeeper." << std::endl; + DRILL_LOG(LOG_TRACE) << "Connected to Zookeeper." << std::endl; } boost::lock_guard<boost::mutex> bufferLock(self->m_cvMutex); self->m_bConnecting=false; @@ -850,7 +1055,7 @@ void ZookeeperImpl::watcher(zhandle_t *zzh, int type, int state, const char *pat void ZookeeperImpl:: debugPrint(){ if(m_zh!=NULL && m_state==ZOO_CONNECTED_STATE){ - BOOST_LOG_TRIVIAL(trace) << m_drillServiceInstance.DebugString(); + DRILL_LOG(LOG_TRACE) << m_drillServiceInstance.DebugString() << std::endl; } } diff --git a/contrib/native/client/src/clientlib/drillClientImpl.hpp b/contrib/native/client/src/clientlib/drillClientImpl.hpp index 0046b3e52..aa0655663 100644 --- a/contrib/native/client/src/clientlib/drillClientImpl.hpp +++ b/contrib/native/client/src/clientlib/drillClientImpl.hpp @@ -17,14 +17,23 @@ */ -#ifndef DRILL_CLIENT_ASYNC_H -#define DRILL_CLIENT_ASYNC_H +#ifndef DRILL_CLIENT_IMPL_H +#define DRILL_CLIENT_IMPL_H + +/* Define some BOOST defines */ +#define BOOST_ASIO_ENABLE_CANCELIO +// If we want to support older versions of windows than Windows 7, we should +// disable IOCP +//#ifdef _WIN32 +//#define BOOST_ASIO_DISABLE_IOCP +//#endif // _WIN32 #include <stdlib.h> #include <time.h> #include <queue> #include <vector> #include <boost/asio.hpp> +#include <boost/asio/deadline_timer.hpp> #include <boost/thread.hpp> #include <zookeeper/zookeeper.h> @@ -32,6 +41,7 @@ #include "drill/drillClient.hpp" #include "rpcEncoder.hpp" #include "rpcDecoder.hpp" +#include "utils.hpp" #include "User.pb.h" #include "UserBitShared.pb.h" @@ -43,7 +53,6 @@ class OutBoundRpcMessage; class RecordBatch; class RpcEncoder; class RpcDecoder; -//struct UserServerEndPoint; class DrillClientQueryResult{ friend class DrillClientImpl; @@ -51,17 +60,20 @@ class DrillClientQueryResult{ DrillClientQueryResult(DrillClientImpl * pClient, uint64_t coordId): m_pClient(pClient), m_coordinationId(coordId), + m_numBatches(0), + m_columnDefs(new std::vector<Drill::FieldMetadata*>), m_bIsQueryPending(true), m_bIsLastChunk(false), m_bCancel(false), - m_bHasSchemaChanged(false), + m_bHasSchemaChanged(false), m_bHasData(false), m_bHasError(false), m_pError(NULL), m_pQueryId(NULL), + m_pSchemaListener(NULL), m_pResultsListener(NULL), - m_pListenerCtx(NULL) - {}; + m_pListenerCtx(NULL) { + }; ~DrillClientQueryResult(){ this->clearAndDestroy(); @@ -73,25 +85,29 @@ class DrillClientQueryResult{ this->m_pListenerCtx = listenerCtx; } - // Synchronous call to get data. Caller assumes ownership of the recod batch + void registerSchemaChangeListener(pfnSchemaListener l){ + m_pSchemaListener=l; + } + + // Synchronous call to get data. Caller assumes ownership of the recod batch // returned and it is assumed to have been consumed. RecordBatch* getNext(); - // Synchronous call to get a look at the next Record Batch. This - // call does not move the current pointer forward. Repeatied calls + // Synchronous call to get a look at the next Record Batch. This + // call does not move the current pointer forward. Repeatied calls // to peekNext return the same value until getNext is called. RecordBatch* peekNext(); // Blocks until data is available. void waitForData(); // placeholder to return an empty col def vector when calls are made out of order. - static std::vector<Drill::FieldMetadata*> s_emptyColDefs; + static FieldDefPtr s_emptyColDefs; - std::vector<Drill::FieldMetadata*>& getColumnDefs(){ + FieldDefPtr getColumnDefs(){ boost::lock_guard<boost::mutex> bufferLock(this->m_schemaMutex); return this->m_columnDefs; } - void cancel(); + void cancel(); bool isCancelled(){return this->m_bCancel;}; bool hasSchemaChanged(){return this->m_bHasSchemaChanged;}; int32_t getCoordinationId(){ return this->m_coordinationId;} @@ -101,7 +117,7 @@ class DrillClientQueryResult{ exec::shared::QueryId& getQueryId(){ return *(this->m_pQueryId); } bool hasError(){ return m_bHasError;} status_t getErrorStatus(){ return m_pError!=NULL?(status_t)m_pError->status:QRY_SUCCESS;} - DrillClientError* getError(){ return m_pError;} + const DrillClientError* getError(){ return m_pError;} private: status_t setupColumnDefs(exec::user::QueryResult* pQueryResult); @@ -114,20 +130,21 @@ class DrillClientQueryResult{ DrillClientImpl* m_pClient; int32_t m_coordinationId; + size_t m_numBatches; // number of record batches received so far // Vector of Buffers holding data returned by the server // Each data buffer is decoded into a RecordBatch std::vector<ByteBuf_t> m_dataBuffers; std::queue<RecordBatch*> m_recordBatches; - std::vector<Drill::FieldMetadata*> m_columnDefs; + FieldDefPtr m_columnDefs; // Mutex to protect schema definitions - boost::mutex m_schemaMutex; + boost::mutex m_schemaMutex; // Mutex for Cond variable for read write to batch vector - boost::mutex m_cvMutex; - // Condition variable to signal arrival of more data. Condition variable is signaled + boost::mutex m_cvMutex; + // Condition variable to signal arrival of more data. Condition variable is signaled // if the recordBatches queue is not empty - boost::condition_variable m_cv; + boost::condition_variable m_cv; // state // if m_bIsQueryPending is true, we continue to wait for results @@ -138,10 +155,12 @@ class DrillClientQueryResult{ bool m_bHasData; bool m_bHasError; - DrillClientError* m_pError; + const DrillClientError* m_pError; exec::shared::QueryId* m_pQueryId; + //Schema change listener + pfnSchemaListener m_pSchemaListener; // Results callback pfnQueryResultsListener m_pResultsListener; @@ -152,33 +171,42 @@ class DrillClientQueryResult{ class DrillClientImpl{ public: DrillClientImpl(): - m_coordinationId(1) , + m_coordinationId(1), + m_handshakeVersion(0), m_bIsConnected(false), - m_pendingRequests(0), - m_pError(NULL), - m_pListenerThread(NULL), - m_socket(m_io_service), - m_rbuf(1024), - m_wbuf(1024) + m_pendingRequests(0), + m_pError(NULL), + m_pListenerThread(NULL), + m_socket(m_io_service), + m_deadlineTimer(m_io_service), + m_rbuf(NULL), + m_wbuf(MAX_SOCK_RD_BUFSIZE) { srand(time(NULL)); m_coordinationId=rand()%1729+1; }; - ~DrillClientImpl(){ - //TODO: Cleanup. + ~DrillClientImpl(){ + //TODO: Cleanup. //Free any record batches or buffers remaining //Cancel any pending requests //Clear and destroy DrillClientQueryResults vector? + m_deadlineTimer.cancel(); + m_io_service.stop(); + m_socket.close(); + if(m_rbuf!=NULL){ + Utils::freeBuffer(m_rbuf); m_rbuf=NULL; + } + if(m_pError!=NULL){ + delete m_pError; m_pError=NULL; + } //Terminate and free the listener thread if(this->m_pListenerThread!=NULL){ this->m_pListenerThread->interrupt(); + this->m_pListenerThread->join(); delete this->m_pListenerThread; } - if(m_pError!=NULL){ - delete m_pError; m_pError=NULL; - } }; //Connect via Zookeeper or directly @@ -187,10 +215,9 @@ class DrillClientImpl{ bool Active(); void Close() ; DrillClientError* getError(){ return m_pError;} - DrillClientQueryResult* SubmitQuery(exec::user::QueryType t, const std::string& plan, pfnQueryResultsListener listener, void* listenerCtx); + DrillClientQueryResult* SubmitQuery(::exec::shared::QueryType t, const std::string& plan, pfnQueryResultsListener listener, void* listenerCtx); void waitForResults(); - bool ValidateHandShake(); // throw expection if not valid - + bool validateHandShake(); private: friend class DrillClientQueryResult; @@ -201,31 +228,30 @@ class DrillClientImpl{ } }; - //allocate memory for Record Batches - ByteBuf_t allocateBuffer(size_t len){ - ByteBuf_t b = (ByteBuf_t)malloc(len); memset(b, 0, len); return b; - } - void freeBuffer(ByteBuf_t b){ free(b); } - // Direct connection to a drillbit // host can be name or ip address, port can be port number or name of service in /etc/services - connectionStatus_t connect(const char* host, const char* port); + connectionStatus_t connect(const char* host, const char* port); int32_t getNextCoordinationId(){ return ++m_coordinationId; }; - void parseConnectStr(const char* connectStr, std::string& protocol, std::string& hostPortStr); - // end and receive synchronous messages - void recvSync(InBoundRpcMessage& msg); - void sendSync(OutBoundRpcMessage& msg); - + void parseConnectStr(const char* connectStr, std::string& pathToDrill, std::string& protocol, std::string& hostPortStr); + // send synchronous messages + //connectionStatus_t recvSync(InBoundRpcMessage& msg); + connectionStatus_t sendSync(OutBoundRpcMessage& msg); + // handshake + connectionStatus_t recvHandshake(); + void handleHandshake(ByteBuf_t b, const boost::system::error_code& err, std::size_t bytes_transferred ); + void handleHShakeReadTimeout(const boost::system::error_code & err); + // Query results void getNextResult(); - status_t readMsg(ByteBuf_t _buf, InBoundRpcMessage& msg, boost::system::error_code& error); - status_t processQueryResult(InBoundRpcMessage& msg); - status_t processQueryId(InBoundRpcMessage& msg ); + status_t readMsg(ByteBuf_t _buf, ByteBuf_t* allocatedBuffer, InBoundRpcMessage& msg, boost::system::error_code& error); + status_t processQueryResult(ByteBuf_t allocatedBuffer, InBoundRpcMessage& msg); + status_t processQueryId(ByteBuf_t allocatedBuffer, InBoundRpcMessage& msg ); + void handleReadTimeout(const boost::system::error_code & err); void handleRead(ByteBuf_t _buf, const boost::system::error_code & err, size_t bytes_transferred) ; status_t validateMessage(InBoundRpcMessage& msg, exec::user::QueryResult& qr, std::string& valError); connectionStatus_t handleConnError(connectionStatus_t status, std::string msg); status_t handleQryError(status_t status, std::string msg, DrillClientQueryResult* pQueryResult); - status_t handleQryError(status_t status, - const exec::shared::DrillPBError& e, + status_t handleQryError(status_t status, + const exec::shared::DrillPBError& e, DrillClientQueryResult* pQueryResult); void broadcastError(DrillClientError* pErr); void clearMapEntries(DrillClientQueryResult* pQueryResult); @@ -237,29 +263,31 @@ class DrillClientImpl{ static RpcDecoder s_decoder; int32_t m_coordinationId; + int32_t m_handshakeVersion; bool m_bIsConnected; - // number of outstanding read requests. + // number of outstanding read requests. // handleRead will keep asking for more results as long as this number is not zero. - size_t m_pendingRequests; + size_t m_pendingRequests; - // Error Object. NULL if no error. Set if the error is valid for ALL running queries. + // Error Object. NULL if no error. Set if the error is valid for ALL running queries. // All the query result objects will // also have the error object set. - // If the error is query specific, only the query results object will have the error set. + // If the error is query specific, only the query results object will have the error set. DrillClientError* m_pError; - // for boost asio + // for boost asio boost::thread * m_pListenerThread; boost::asio::io_service m_io_service; boost::asio::ip::tcp::socket m_socket; + boost::asio::deadline_timer m_deadlineTimer; // to timeout async queries that never return //for synchronous messages, like validate handshake - DataBuf m_rbuf; // buffer for receiving synchronous messages + ByteBuf_t m_rbuf; // buffer for receiving synchronous messages DataBuf m_wbuf; // buffer for sending synchronous message - // Mutex to protect drill client operations - boost::mutex m_dcMutex; + // Mutex to protect drill client operations + boost::mutex m_dcMutex; // Map of coordination id to Query Ids. std::map<int, DrillClientQueryResult*> m_queryIds; @@ -283,12 +311,12 @@ inline void DrillClientImpl::Close() { class ZookeeperImpl{ public: - ZookeeperImpl(); - ~ZookeeperImpl(); + ZookeeperImpl(); + ~ZookeeperImpl(); static ZooLogLevel getZkLogLevel(); - // comma separated host:port pairs, each corresponding to a zk + // comma separated host:port pairs, each corresponding to a zk // server. e.g. "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002 - int connectToZookeeper(const char* connectStr); + int connectToZookeeper(const char* connectStr, const char* pathToDrill); void close(); static void watcher(zhandle_t *zzh, int type, int state, const char *path, void* context); void debugPrint(); @@ -297,16 +325,17 @@ class ZookeeperImpl{ private: static char s_drillRoot[]; - zhandle_t* m_zh; + static char s_defaultCluster[]; + zhandle_t* m_zh; clientid_t m_id; int m_state; std::string m_err; struct String_vector* m_pDrillbits; - boost::mutex m_cvMutex; - // Condition variable to signal connection callback has been processed - boost::condition_variable m_cv; + boost::mutex m_cvMutex; + // Condition variable to signal connection callback has been processed + boost::condition_variable m_cv; bool m_bConnecting; exec::DrillServiceInstance m_drillServiceInstance; }; diff --git a/contrib/native/client/src/clientlib/errmsgs.cpp b/contrib/native/client/src/clientlib/errmsgs.cpp index 0b74225f0..966cfc27b 100644 --- a/contrib/native/client/src/clientlib/errmsgs.cpp +++ b/contrib/native/client/src/clientlib/errmsgs.cpp @@ -29,6 +29,8 @@ static Drill::ErrorMessages errorMessages[]={ {ERR_CONN_FAILURE, ERR_CATEGORY_CONN, 0, "Connection failure. Host:%s port:%s. Error: %s."}, {ERR_CONN_EXCEPT, ERR_CATEGORY_CONN, 0, "Socket connection failure with the following exception: %s."}, {ERR_CONN_UNKPROTO, ERR_CATEGORY_CONN, 0, "Unknown protocol: %s."}, + {ERR_CONN_RDFAIL, ERR_CATEGORY_CONN, 0, "A socket read failed with error: %s."}, + {ERR_CONN_WFAIL, ERR_CATEGORY_CONN, 0, "Synchronous socket write failed with error: %s."}, {ERR_CONN_ZOOKEEPER, ERR_CATEGORY_CONN, 0, "Zookeeper error. %s"}, {ERR_CONN_NOHSHAKE, ERR_CATEGORY_CONN, 0, "Handshake failed: Expected RPC version %d, got %d."}, {ERR_CONN_ZKFAIL, ERR_CATEGORY_CONN, 0, "Failed to connect to Zookeeper."}, @@ -45,7 +47,7 @@ static Drill::ErrorMessages errorMessages[]={ {ERR_QRY_INVRPCTYPE, ERR_CATEGORY_QRY, 0, "Unknown rpc type received from server:%d."}, {ERR_QRY_OUTOFORDER, ERR_CATEGORY_QRY, 0, "Internal Error: Query result received before query id. Aborting ..."}, {ERR_QRY_INVRPC, ERR_CATEGORY_QRY, 0, "Rpc Error: %s."}, - {ERR_QRY_8, ERR_CATEGORY_QRY, 0, "Query Failed."}, + {ERR_QRY_TIMOUT, ERR_CATEGORY_QRY, 0, "Timed out waiting for server to respond."}, {ERR_QRY_FAILURE, ERR_CATEGORY_QRY, 0, "Query execution error. Details:[ \n%s\n]"}, {ERR_QRY_SELVEC2, ERR_CATEGORY_QRY, 0, "Receiving a selection_vector_2 from the server came as a complete surprise at this point"}, {ERR_QRY_RESPFAIL, ERR_CATEGORY_QRY, 0, "Got a RESPONSE_FAILURE from the server and don't know what to do"}, @@ -66,7 +68,7 @@ std::string getMessage(uint32_t msgId, ...){ assert(msgId <= ERR_QRY_MAX); va_list args; va_start (args, msgId); - vsprintf (str, errorMessages[msgId].msgFormatStr, args); + vsprintf (str, errorMessages[msgId-DRILL_ERR_START].msgFormatStr, args); va_end (args); s=std::string("[")+boost::lexical_cast<std::string>(msgId)+std::string("]")+str; return s; diff --git a/contrib/native/client/src/clientlib/errmsgs.hpp b/contrib/native/client/src/clientlib/errmsgs.hpp index e5ea3ce30..437335c56 100644 --- a/contrib/native/client/src/clientlib/errmsgs.hpp +++ b/contrib/native/client/src/clientlib/errmsgs.hpp @@ -27,33 +27,37 @@ namespace Drill{ #define ERR_CATEGORY_CONN 10000 #define ERR_CATEGORY_QRY 20000 -#define ERR_NONE 0 - -#define ERR_CONN_FAILURE 1 -#define ERR_CONN_EXCEPT 2 -#define ERR_CONN_UNKPROTO 3 -#define ERR_CONN_ZOOKEEPER 4 -#define ERR_CONN_NOHSHAKE 5 -#define ERR_CONN_ZKFAIL 6 -#define ERR_CONN_ZKTIMOUT 7 -#define ERR_CONN_ZKERR 8 -#define ERR_CONN_ZKDBITERR 9 -#define ERR_CONN_ZKNODBIT 10 -#define ERR_CONN_ZKNOAUTH 11 -#define ERR_CONN_ZKEXP 12 -#define ERR_CONN_MAX 12 - -#define ERR_QRY_OUTOFMEM ERR_CONN_MAX+1 + +#define DRILL_ERR_START 30000 // arbitrary +#define ERR_NONE DRILL_ERR_START+0 + +#define ERR_CONN_FAILURE DRILL_ERR_START+1 +#define ERR_CONN_EXCEPT DRILL_ERR_START+2 +#define ERR_CONN_UNKPROTO DRILL_ERR_START+3 +#define ERR_CONN_RDFAIL DRILL_ERR_START+4 +#define ERR_CONN_WFAIL DRILL_ERR_START+5 +#define ERR_CONN_ZOOKEEPER DRILL_ERR_START+6 +#define ERR_CONN_NOHSHAKE DRILL_ERR_START+7 +#define ERR_CONN_ZKFAIL DRILL_ERR_START+8 +#define ERR_CONN_ZKTIMOUT DRILL_ERR_START+9 +#define ERR_CONN_ZKERR DRILL_ERR_START+10 +#define ERR_CONN_ZKDBITERR DRILL_ERR_START+11 +#define ERR_CONN_ZKNODBIT DRILL_ERR_START+12 +#define ERR_CONN_ZKNOAUTH DRILL_ERR_START+13 +#define ERR_CONN_ZKEXP DRILL_ERR_START+14 +#define ERR_CONN_MAX DRILL_ERR_START+14 + +#define ERR_QRY_OUTOFMEM ERR_CONN_MAX+1 #define ERR_QRY_COMMERR ERR_CONN_MAX+2 #define ERR_QRY_INVREADLEN ERR_CONN_MAX+3 #define ERR_QRY_INVQUERYID ERR_CONN_MAX+4 #define ERR_QRY_INVRPCTYPE ERR_CONN_MAX+5 #define ERR_QRY_OUTOFORDER ERR_CONN_MAX+6 #define ERR_QRY_INVRPC ERR_CONN_MAX+7 -#define ERR_QRY_8 ERR_CONN_MAX+8 +#define ERR_QRY_TIMOUT ERR_CONN_MAX+8 #define ERR_QRY_FAILURE ERR_CONN_MAX+9 #define ERR_QRY_SELVEC2 ERR_CONN_MAX+10 -#define ERR_QRY_RESPFAIL ERR_CONN_MAX+11 +#define ERR_QRY_RESPFAIL ERR_CONN_MAX+11 #define ERR_QRY_12 ERR_CONN_MAX+12 #define ERR_QRY_UNKQRY ERR_CONN_MAX+13 #define ERR_QRY_CANCELED ERR_CONN_MAX+14 @@ -63,7 +67,7 @@ namespace Drill{ #define ERR_QRY_18 ERR_CONN_MAX+18 #define ERR_QRY_19 ERR_CONN_MAX+19 #define ERR_QRY_20 ERR_CONN_MAX+20 -#define ERR_QRY_MAX ERR_QRY_20 +#define ERR_QRY_MAX ERR_QRY_20 // Use only Plain Old Data types in this struc. We will declare // a global. diff --git a/contrib/native/client/src/clientlib/logger.cpp b/contrib/native/client/src/clientlib/logger.cpp new file mode 100644 index 000000000..5411d01eb --- /dev/null +++ b/contrib/native/client/src/clientlib/logger.cpp @@ -0,0 +1,69 @@ +/* + * 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 + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "boost/date_time/posix_time/posix_time.hpp" +#include "boost/thread.hpp" + +#include "logger.hpp" + +namespace Drill{ + +std::string getTime(){ + return to_simple_string(boost::posix_time::second_clock::local_time()); +} + +std::string getTid(){ + return boost::lexical_cast<std::string>(boost::this_thread::get_id()); +} + +logLevel_t Logger::s_level=LOG_ERROR; +std::ostream* Logger::s_pOutStream=NULL; +std::ofstream* Logger::s_pOutFileStream=NULL; +char* Logger::s_filepath=NULL; + +void Logger::init(const char* path){ + if(path!=NULL) { + s_pOutFileStream = new std::ofstream; + s_pOutFileStream->open(path, std::ofstream::out); + if(!s_pOutFileStream->is_open()){ + std::cerr << "Logfile could not be opened. Logging to stdout" << std::endl; + } + } + s_pOutStream=(s_pOutFileStream!=NULL && s_pOutFileStream->is_open())?s_pOutFileStream:&std::cout; +} + +void Logger::close(){ + if(s_pOutFileStream !=NULL){ + if(s_pOutFileStream->is_open()){ + s_pOutFileStream->close(); + } + delete s_pOutFileStream; s_pOutFileStream=NULL; + } +} + +std::ostream& Logger::log(logLevel_t level){ + *s_pOutStream << getTime(); + *s_pOutStream << " : "<<levelAsString(level); + *s_pOutStream << " : "<<getTid(); + *s_pOutStream << " : "; + return *s_pOutStream; +} + + +} // namespace Drill + diff --git a/contrib/native/client/src/clientlib/logger.hpp b/contrib/native/client/src/clientlib/logger.hpp new file mode 100644 index 000000000..e3edb1329 --- /dev/null +++ b/contrib/native/client/src/clientlib/logger.hpp @@ -0,0 +1,72 @@ +/* + * 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 + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __LOGGER_H +#define __LOGGER_H + +#include <sstream> +#include <ostream> +#include <fstream> +#include <string> +#include <stdio.h> + +#include "drill/common.hpp" + +namespace Drill{ + +class Logger{ + public: + Logger(){} + ~Logger(){ } + + static void init(const char* path); + static void close(); + static std::ostream& log(logLevel_t level); + static std::string levelAsString(logLevel_t level) { + static const char* const levelNames[] = { + "TRACE", + "DEBUG", + "INFO", + "WARNING", + "ERROR", + "FATAL" + }; + return levelNames[level]; + } + + // The logging level + static logLevel_t s_level; + static std::ostream* s_pOutStream; + + private: + //static std::ostream* s_pOutStream; + static std::ofstream* s_pOutFileStream; + static char* s_filepath; + +}; // Logger + +std::string getTime(); +std::string getTid(); + +#define DRILL_LOG(level) \ + if (Logger::s_pOutStream==NULL || level < Drill::Logger::s_level); \ + else Drill::Logger::log(level) \ + +} // namespace Drill + +#endif diff --git a/contrib/native/client/src/clientlib/recordBatch.cpp b/contrib/native/client/src/clientlib/recordBatch.cpp index 066b89864..27a592d63 100644 --- a/contrib/native/client/src/clientlib/recordBatch.cpp +++ b/contrib/native/client/src/clientlib/recordBatch.cpp @@ -16,11 +16,9 @@ * limitations under the License. */ - -#include <boost/log/trivial.hpp> - #include "drill/common.hpp" #include "drill/recordBatch.hpp" +#include "utils.hpp" const uint32_t YEARS_TO_MONTHS=12; const uint32_t HOURS_TO_MILLIS=60*60*1000; @@ -33,14 +31,14 @@ static char timezoneMap[][36]={ "Africa/Abidjan", "Africa/Accra", "Africa/Addis_Ababa", "Africa/Algiers", "Africa/Asmara", "Africa/Asmera", "Africa/Bamako", "Africa/Bangui", "Africa/Banjul", "Africa/Bissau", "Africa/Blantyre", "Africa/Brazzaville", "Africa/Bujumbura", "Africa/Cairo", "Africa/Casablanca", "Africa/Ceuta", "Africa/Conakry", "Africa/Dakar", - "Africa/Dar_es_Salaam", "Africa/Djibouti", "Africa/Douala", "Africa/El_Aaiun", + "Africa/Dar_es_Salaam", "Africa/Djibouti", "Africa/Douala", "Africa/El_Aaiun", "Africa/Freetown", "Africa/Gaborone", "Africa/Harare", "Africa/Johannesburg", "Africa/Juba", "Africa/Kampala", "Africa/Khartoum", "Africa/Kigali", "Africa/Kinshasa", "Africa/Lagos", "Africa/Libreville", "Africa/Lome", "Africa/Luanda", "Africa/Lubumbashi", "Africa/Lusaka", "Africa/Malabo", "Africa/Maputo", "Africa/Maseru", "Africa/Mbabane", "Africa/Mogadishu", - "Africa/Monrovia", "Africa/Nairobi", "Africa/Ndjamena", "Africa/Niamey", + "Africa/Monrovia", "Africa/Nairobi", "Africa/Ndjamena", "Africa/Niamey", "Africa/Nouakchott", "Africa/Ouagadougou", - "Africa/Porto-Novo", "Africa/Sao_Tome", "Africa/Timbuktu", "Africa/Tripoli", + "Africa/Porto-Novo", "Africa/Sao_Tome", "Africa/Timbuktu", "Africa/Tripoli", "Africa/Tunis", "Africa/Windhoek", "America/Adak", "America/Anchorage", "America/Anguilla", "America/Antigua", "America/Araguaina", "America/Argentina/Buenos_Aires", "America/Argentina/Catamarca", "America/Argentina/ComodRivadavia", @@ -57,10 +55,10 @@ static char timezoneMap[][36]={ "America/Edmonton", "America/Eirunepe", "America/El_Salvador", "America/Ensenada", "America/Fort_Wayne", "America/Fortaleza", "America/Glace_Bay", "America/Godthab", "America/Goose_Bay", "America/Grand_Turk", "America/Grenada", "America/Guadeloupe", "America/Guatemala", "America/Guayaquil", "America/Guyana", - "America/Halifax", "America/Havana", "America/Hermosillo", + "America/Halifax", "America/Havana", "America/Hermosillo", "America/Indiana/Indianapolis", "America/Indiana/Knox", "America/Indiana/Marengo", "America/Indiana/Petersburg", "America/Indiana/Tell_City", - "America/Indiana/Vevay", "America/Indiana/Vincennes", "America/Indiana/Winamac", + "America/Indiana/Vevay", "America/Indiana/Vincennes", "America/Indiana/Winamac", "America/Indianapolis", "America/Inuvik", "America/Iqaluit", "America/Jamaica", "America/Jujuy", "America/Juneau", "America/Kentucky/Louisville", "America/Kentucky/Monticello", "America/Knox_IN", "America/Kralendijk", "America/La_Paz", "America/Lima", @@ -68,23 +66,23 @@ static char timezoneMap[][36]={ "America/Manaus", "America/Marigot", "America/Martinique", "America/Matamoros", "America/Mazatlan", "America/Mendoza", "America/Menominee", "America/Merida", "America/Metlakatla", "America/Mexico_City", "America/Miquelon", "America/Moncton", "America/Monterrey", "America/Montevideo", "America/Montreal", - "America/Montserrat", "America/Nassau", "America/New_York", "America/Nipigon", + "America/Montserrat", "America/Nassau", "America/New_York", "America/Nipigon", "America/Nome", "America/Noronha", "America/North_Dakota/Beulah", "America/North_Dakota/Center", "America/North_Dakota/New_Salem", "America/Ojinaga", "America/Panama", "America/Pangnirtung", "America/Paramaribo", "America/Phoenix", "America/Port-au-Prince", "America/Port_of_Spain", "America/Porto_Acre", "America/Porto_Velho", "America/Puerto_Rico", "America/Rainy_River", "America/Rankin_Inlet", - "America/Recife", "America/Regina", "America/Resolute", "America/Rio_Branco", + "America/Recife", "America/Regina", "America/Resolute", "America/Rio_Branco", "America/Rosario", "America/Santa_Isabel", "America/Santarem", "America/Santiago", "America/Santo_Domingo", - "America/Sao_Paulo", "America/Scoresbysund", "America/Shiprock", "America/Sitka", + "America/Sao_Paulo", "America/Scoresbysund", "America/Shiprock", "America/Sitka", "America/St_Barthelemy", "America/St_Johns", "America/St_Kitts", "America/St_Lucia", "America/St_Thomas", "America/St_Vincent", "America/Swift_Current", "America/Tegucigalpa", - "America/Thule", "America/Thunder_Bay", "America/Tijuana", "America/Toronto", + "America/Thule", "America/Thunder_Bay", "America/Tijuana", "America/Toronto", "America/Tortola", "America/Vancouver", - "America/Virgin", "America/Whitehorse", "America/Winnipeg", "America/Yakutat", + "America/Virgin", "America/Whitehorse", "America/Winnipeg", "America/Yakutat", "America/Yellowknife", "Antarctica/Casey", "Antarctica/Davis", "Antarctica/DumontDUrville", "Antarctica/Macquarie", "Antarctica/Mawson", "Antarctica/McMurdo", "Antarctica/Palmer", @@ -104,33 +102,33 @@ static char timezoneMap[][36]={ "Asia/Shanghai", "Asia/Singapore", "Asia/Taipei", "Asia/Tashkent", "Asia/Tbilisi", "Asia/Tehran", "Asia/Tel_Aviv", "Asia/Thimbu", "Asia/Thimphu", "Asia/Tokyo", "Asia/Ujung_Pandang", "Asia/Ulaanbaatar", "Asia/Ulan_Bator", "Asia/Urumqi", "Asia/Vientiane", "Asia/Vladivostok", "Asia/Yakutsk", "Asia/Yekaterinburg", - "Asia/Yerevan", "Atlantic/Azores", "Atlantic/Bermuda", "Atlantic/Canary", + "Asia/Yerevan", "Atlantic/Azores", "Atlantic/Bermuda", "Atlantic/Canary", "Atlantic/Cape_Verde", "Atlantic/Faeroe", "Atlantic/Faroe", "Atlantic/Jan_Mayen", "Atlantic/Madeira", "Atlantic/Reykjavik", "Atlantic/South_Georgia", "Atlantic/St_Helena", - "Atlantic/Stanley", "Australia/ACT", "Australia/Adelaide", "Australia/Brisbane", + "Atlantic/Stanley", "Australia/ACT", "Australia/Adelaide", "Australia/Brisbane", "Australia/Broken_Hill", "Australia/Canberra", - "Australia/Currie", "Australia/Darwin", "Australia/Eucla", "Australia/Hobart", + "Australia/Currie", "Australia/Darwin", "Australia/Eucla", "Australia/Hobart", "Australia/LHI", "Australia/Lindeman", - "Australia/Lord_Howe", "Australia/Melbourne", "Australia/NSW", "Australia/North", + "Australia/Lord_Howe", "Australia/Melbourne", "Australia/NSW", "Australia/North", "Australia/Perth", "Australia/Queensland", - "Australia/South", "Australia/Sydney", "Australia/Tasmania", "Australia/Victoria", + "Australia/South", "Australia/Sydney", "Australia/Tasmania", "Australia/Victoria", "Australia/West", "Australia/Yancowinna", "Brazil/Acre", "Brazil/DeNoronha", "Brazil/East", "Brazil/West", "CET", "CST6CDT", - "Canada/Atlantic", "Canada/Central", "Canada/East-Saskatchewan", "Canada/Eastern", + "Canada/Atlantic", "Canada/Central", "Canada/East-Saskatchewan", "Canada/Eastern", "Canada/Mountain", "Canada/Newfoundland", "Canada/Pacific", "Canada/Saskatchewan", "Canada/Yukon", "Chile/Continental", "Chile/EasterIsland", "Cuba", "EET", "EST", "EST5EDT", "Egypt", "Eire", "Etc/GMT", "Etc/GMT+0", "Etc/GMT+1", "Etc/GMT+10", - "Etc/GMT+11", "Etc/GMT+12", "Etc/GMT+2", "Etc/GMT+3", "Etc/GMT+4", "Etc/GMT+5", "Etc/GMT+6", + "Etc/GMT+11", "Etc/GMT+12", "Etc/GMT+2", "Etc/GMT+3", "Etc/GMT+4", "Etc/GMT+5", "Etc/GMT+6", "Etc/GMT+7", "Etc/GMT+8", - "Etc/GMT+9", "Etc/GMT-0", "Etc/GMT-1", "Etc/GMT-10", "Etc/GMT-11", "Etc/GMT-12", + "Etc/GMT+9", "Etc/GMT-0", "Etc/GMT-1", "Etc/GMT-10", "Etc/GMT-11", "Etc/GMT-12", "Etc/GMT-13", "Etc/GMT-14", "Etc/GMT-2", - "Etc/GMT-3", "Etc/GMT-4", "Etc/GMT-5", "Etc/GMT-6", "Etc/GMT-7", "Etc/GMT-8", + "Etc/GMT-3", "Etc/GMT-4", "Etc/GMT-5", "Etc/GMT-6", "Etc/GMT-7", "Etc/GMT-8", "Etc/GMT-9", "Etc/GMT0", "Etc/Greenwich", "Etc/UCT", "Etc/UTC", "Etc/Universal", "Etc/Zulu", "Europe/Amsterdam", "Europe/Andorra", "Europe/Athens", "Europe/Belfast", "Europe/Belgrade", "Europe/Berlin", "Europe/Bratislava", "Europe/Brussels", "Europe/Bucharest", "Europe/Budapest", "Europe/Chisinau", - "Europe/Copenhagen", "Europe/Dublin", "Europe/Gibraltar", "Europe/Guernsey", + "Europe/Copenhagen", "Europe/Dublin", "Europe/Gibraltar", "Europe/Guernsey", "Europe/Helsinki", "Europe/Isle_of_Man", "Europe/Istanbul", "Europe/Jersey", "Europe/Kaliningrad", "Europe/Kiev", "Europe/Lisbon", "Europe/Ljubljana", "Europe/London", "Europe/Luxembourg", "Europe/Madrid", "Europe/Malta", "Europe/Mariehamn", "Europe/Minsk", @@ -145,20 +143,20 @@ static char timezoneMap[][36]={ "Indian/Mayotte", "Indian/Reunion", "Iran", "Israel", "Jamaica", "Japan", "Kwajalein", "Libya", "MET", "MST", "MST7MDT", "Mexico/BajaNorte", "Mexico/BajaSur", "Mexico/General", "NZ", "NZ-CHAT", "Navajo", "PRC", "PST8PDT", "Pacific/Apia", "Pacific/Auckland", "Pacific/Chatham", "Pacific/Chuuk", "Pacific/Easter", - "Pacific/Efate", "Pacific/Enderbury", "Pacific/Fakaofo", "Pacific/Fiji", + "Pacific/Efate", "Pacific/Enderbury", "Pacific/Fakaofo", "Pacific/Fiji", "Pacific/Funafuti", "Pacific/Galapagos", - "Pacific/Gambier", "Pacific/Guadalcanal", "Pacific/Guam", "Pacific/Honolulu", + "Pacific/Gambier", "Pacific/Guadalcanal", "Pacific/Guam", "Pacific/Honolulu", "Pacific/Johnston", "Pacific/Kiritimati", - "Pacific/Kosrae", "Pacific/Kwajalein", "Pacific/Majuro", "Pacific/Marquesas", + "Pacific/Kosrae", "Pacific/Kwajalein", "Pacific/Majuro", "Pacific/Marquesas", "Pacific/Midway", "Pacific/Nauru", - "Pacific/Niue", "Pacific/Norfolk", "Pacific/Noumea", "Pacific/Pago_Pago", + "Pacific/Niue", "Pacific/Norfolk", "Pacific/Noumea", "Pacific/Pago_Pago", "Pacific/Palau", "Pacific/Pitcairn", - "Pacific/Pohnpei", "Pacific/Ponape", "Pacific/Port_Moresby", "Pacific/Rarotonga", + "Pacific/Pohnpei", "Pacific/Ponape", "Pacific/Port_Moresby", "Pacific/Rarotonga", "Pacific/Saipan", "Pacific/Samoa", "Pacific/Tahiti", "Pacific/Tarawa", "Pacific/Tongatapu", "Pacific/Truk", "Pacific/Wake", "Pacific/Wallis", "Pacific/Yap", "Poland", "Portugal", "ROC", "ROK", "Singapore", "Turkey", "UCT", "US/Alaska", "US/Aleutian", "US/Arizona", "US/Central", "US/East-Indiana", "US/Eastern", "US/Hawaii", "US/Indiana-Starke", - "US/Michigan", "US/Mountain", "US/Pacific", "US/Pacific-New", "US/Samoa", + "US/Michigan", "US/Mountain", "US/Pacific", "US/Pacific-New", "US/Samoa", "UTC", "Universal", "W-SU", "WET", "Zulu" }; @@ -214,12 +212,12 @@ ValueVectorBase* ValueVectorFactory::allocateValueVector(const Drill::FieldMetad case common::BIT: return new ValueVectorBit(b,f.getValueCount()); case common::VARBINARY: - return new ValueVectorVarBinary(b, f.getValueCount()); + return new ValueVectorVarBinary(b, f.getValueCount()); case common::VARCHAR: - return new ValueVectorVarChar(b, f.getValueCount()); + return new ValueVectorVarChar(b, f.getValueCount()); case common::MONEY: default: - return new ValueVectorUnimplemented(b, f.getValueCount()); + return new ValueVectorUnimplemented(b, f.getValueCount()); } case common::DM_OPTIONAL: switch (type) { @@ -236,28 +234,28 @@ ValueVectorBase* ValueVectorFactory::allocateValueVector(const Drill::FieldMetad case common::FLOAT8: return new NullableValueVectorFixed<double>(b,f.getValueCount()); case common::DATE: - return new NullableValueVectorTyped<DateHolder, + return new NullableValueVectorTyped<DateHolder, ValueVectorTyped<DateHolder, uint64_t> >(b,f.getValueCount()); case common::TIMESTAMP: - return new NullableValueVectorTyped<DateTimeHolder, + return new NullableValueVectorTyped<DateTimeHolder, ValueVectorTyped<DateTimeHolder, uint64_t> >(b,f.getValueCount()); case common::TIME: return new NullableValueVectorTyped<TimeHolder, ValueVectorTyped<TimeHolder, uint32_t> >(b,f.getValueCount()); case common::TIMESTAMPTZ: - return new NullableValueVectorTyped<DateTimeTZHolder, + return new NullableValueVectorTyped<DateTimeTZHolder, ValueVectorTypedComposite<DateTimeTZHolder> >(b,f.getValueCount()); case common::INTERVAL: - return new NullableValueVectorTyped<IntervalHolder, + return new NullableValueVectorTyped<IntervalHolder, ValueVectorTypedComposite<IntervalHolder> >(b,f.getValueCount()); case common::INTERVALDAY: - return new NullableValueVectorTyped<IntervalDayHolder, + return new NullableValueVectorTyped<IntervalDayHolder, ValueVectorTypedComposite<IntervalDayHolder> >(b,f.getValueCount()); case common::INTERVALYEAR: - return new NullableValueVectorTyped<IntervalYearHolder, + return new NullableValueVectorTyped<IntervalYearHolder, ValueVectorTypedComposite<IntervalYearHolder> >(b,f.getValueCount()); case common::BIT: - return new NullableValueVectorTyped<uint8_t, + return new NullableValueVectorTyped<uint8_t, ValueVectorBit >(b,f.getValueCount()); case common::VARBINARY: //TODO: Varbinary is untested @@ -266,16 +264,16 @@ ValueVectorBase* ValueVectorFactory::allocateValueVector(const Drill::FieldMetad return new NullableValueVectorTyped<VarWidthHolder, ValueVectorVarChar >(b,f.getValueCount()); // not implemented yet default: - return new ValueVectorUnimplemented(b, f.getValueCount()); + return new ValueVectorUnimplemented(b, f.getValueCount()); } case common::DM_REPEATED: switch (type) { // not implemented yet default: - return new ValueVectorUnimplemented(b, f.getValueCount()); + return new ValueVectorUnimplemented(b, f.getValueCount()); } } - return new ValueVectorUnimplemented(b, f.getValueCount()); + return new ValueVectorUnimplemented(b, f.getValueCount()); } @@ -285,13 +283,28 @@ ret_t FieldBatch::load(){ return RET_SUCCESS; } +RecordBatch::~RecordBatch(){ + m_buffer=NULL; + //free memory allocated for FieldBatch objects saved in m_fields; + for(std::vector<FieldBatch*>::iterator it = m_fields.begin(); it != m_fields.end(); ++it){ + delete *it; + } + m_fields.clear(); + for(std::vector<Drill::FieldMetadata*>::iterator it = m_fieldDefs->begin(); it != m_fieldDefs->end(); ++it){ + delete *it; + } + m_fieldDefs->clear(); + delete m_pQueryResult; + Utils::freeBuffer(m_allocatedBuffer); +} + ret_t RecordBatch::build(){ // For every Field, get the corresponding SlicedByteBuf. - // Create a Materialized field. Set the Sliced Byted Buf to the correct slice. + // Create a Materialized field. Set the Sliced Byted Buf to the correct slice. // Set the Field Metadata. // Load the vector.(Load creates a valuevector object of the correct type: - // Use ValueVectorFactory(type) to create the right type. - // Create a Value Vector of the Sliced Byte Buf. + // Use ValueVectorFactory(type) to create the right type. + // Create a Value Vector of the Sliced Byte Buf. // Add the field batch to vector size_t startOffset=0; //TODO: handle schema changes here. Call a client provided callback? @@ -305,7 +318,7 @@ ret_t RecordBatch::build(){ startOffset+=len; pField->load(); // set up the value vectors this->m_fields.push_back(pField); - this->m_fieldDefs.push_back(pFmd); + this->m_fieldDefs->push_back(pFmd); } return RET_SUCCESS; } @@ -317,7 +330,7 @@ void RecordBatch::print(std::ostream& s, size_t num){ std::string name= fmd.getName(); nameList+=name; nameList+=" "; - } + } size_t numToPrint=this->m_numRecords; if(num>0 && num<numToPrint)numToPrint=num; s<<nameList<<std::endl; @@ -335,7 +348,7 @@ void RecordBatch::print(std::ostream& s, size_t num){ } values+=valueBuf; values+=" "; - } + } s<<values<<std::endl; } } diff --git a/contrib/native/client/src/clientlib/rpcDecoder.cpp b/contrib/native/client/src/clientlib/rpcDecoder.cpp index 6fb9c249d..c1001fd9d 100644 --- a/contrib/native/client/src/clientlib/rpcDecoder.cpp +++ b/contrib/native/client/src/clientlib/rpcDecoder.cpp @@ -48,6 +48,7 @@ int RpcDecoder::LengthDecode(const uint8_t* buf, uint32_t* p_length) { cerr << "Reading full length " << *p_length << endl; #endif assert( (pos1-pos0) == getRawVarintSize(*p_length)); + delete cis; return (pos1-pos0); } @@ -143,6 +144,7 @@ int RpcDecoder::Decode(const uint8_t* buf, int length, InBoundRpcMessage& msg) { int pos1 = cis->CurrentPosition(); assert((pos1-pos0) == length); + delete cis; return (pos1-pos0); } diff --git a/contrib/native/client/src/clientlib/rpcEncoder.cpp b/contrib/native/client/src/clientlib/rpcEncoder.cpp index 5d28a339e..2f354d7a7 100644 --- a/contrib/native/client/src/clientlib/rpcEncoder.cpp +++ b/contrib/native/client/src/clientlib/rpcEncoder.cpp @@ -99,6 +99,9 @@ bool RpcEncoder::Encode(DataBuf& buf, OutBoundRpcMessage& msg) { cos->WriteVarint32(proto_body_length); msg.m_pbody->SerializeToCodedStream(cos); + delete os; + delete cos; + // Done! no read to write data body for client return true; } diff --git a/contrib/native/client/src/clientlib/utils.hpp b/contrib/native/client/src/clientlib/utils.hpp new file mode 100644 index 000000000..9def9b4da --- /dev/null +++ b/contrib/native/client/src/clientlib/utils.hpp @@ -0,0 +1,47 @@ +/* + * 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 + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __UTILS_H +#define __UTILS_H + +#include <sstream> +#include <ostream> +#include <fstream> +#include <string> +#include <stdlib.h> + +#include "drill/common.hpp" + +namespace Drill{ + +class Utils{ + public: + + //allocate memory for Record Batches + static ByteBuf_t allocateBuffer(size_t len){ + //http://stackoverflow.com/questions/2688466/why-mallocmemset-is-slower-than-calloc + ByteBuf_t b = (ByteBuf_t)calloc(len, sizeof(Byte_t)); return b; + } + static void freeBuffer(ByteBuf_t b){ free(b); } + +}; // Utils + + +} // namespace Drill + +#endif diff --git a/contrib/native/client/src/include/drill/common.hpp b/contrib/native/client/src/include/drill/common.hpp index 436805861..2113ce5e1 100644 --- a/contrib/native/client/src/include/drill/common.hpp +++ b/contrib/native/client/src/include/drill/common.hpp @@ -23,13 +23,19 @@ #include <stdint.h> #include <string> #include <vector> +#include <boost/shared_ptr.hpp> + +#define DRILL_RPC_VERSION 1 #define LENGTH_PREFIX_MAX_LENGTH 5 #define LEN_PREFIX_BUFLEN LENGTH_PREFIX_MAX_LENGTH +#define MAX_CONNECT_STR 4096 +#define MAX_SOCK_RD_BUFSIZE 1024 + #ifdef _DEBUG #define EXTRA_DEBUGGING -#define CODER_DEBUGGING +#define CODER_DEBUGGING #endif namespace Drill { @@ -39,12 +45,15 @@ typedef std::vector<uint8_t> DataBuf; typedef uint8_t Byte_t; typedef Byte_t * ByteBuf_t; +class FieldMetadata; +typedef boost::shared_ptr< std::vector<Drill::FieldMetadata*> > FieldDefPtr; + typedef enum{ - QRY_SUCCESS=0, - QRY_FAILURE=1, - QRY_SUCCESS_WITH_INFO=2, - QRY_NO_MORE_DATA=3, - QRY_CANCEL=4, + QRY_SUCCESS=0, + QRY_FAILURE=1, + QRY_SUCCESS_WITH_INFO=2, + QRY_NO_MORE_DATA=3, + QRY_CANCEL=4, QRY_OUT_OF_BOUNDS=5, QRY_CLIENT_OUTOFMEM=6, QRY_INTERNAL_ERROR=7, @@ -52,8 +61,8 @@ typedef enum{ } status_t; typedef enum{ - CONN_SUCCESS=0, - CONN_FAILURE=1, + CONN_SUCCESS=0, + CONN_FAILURE=1, CONN_HANDSHAKE_FAILED=2, CONN_INVALID_INPUT=3, CONN_ZOOKEEPER_ERROR=4 diff --git a/contrib/native/client/src/include/drill/drillClient.hpp b/contrib/native/client/src/include/drill/drillClient.hpp index 0e85dcc93..6d59afb5d 100644 --- a/contrib/native/client/src/include/drill/drillClient.hpp +++ b/contrib/native/client/src/include/drill/drillClient.hpp @@ -21,8 +21,6 @@ #define DRILL_CLIENT_H #include <vector> -#include <boost/log/core.hpp> -#include <boost/log/trivial.hpp> #include <boost/thread.hpp> #include "drill/common.hpp" #include "drill/protobuf/User.pb.h" @@ -42,7 +40,7 @@ #if __GNUC__ >= 4 #define DECLSPEC_DRILL_CLIENT __attribute__ ((visibility ("default"))) #else - #define DECLSPEC_DRILL_CLIENT + #define DECLSPEC_DRILL_CLIENT #endif #endif @@ -65,7 +63,7 @@ class DECLSPEC_DRILL_CLIENT DrillClientError{ static DrillClientError* getErrorObject(const exec::shared::DrillPBError& e); - // To get the error number we add a error range start number to + // To get the error number we add a error range start number to // the status code returned (either status_t or connectionStatus_t) uint32_t status; // could be either status_t or connectionStatus_t uint32_t errnum; @@ -83,10 +81,13 @@ class DECLSPEC_DRILL_CLIENT DrillClientInitializer{ class DECLSPEC_DRILL_CLIENT DrillClientConfig{ public: DrillClientConfig(); + ~DrillClientConfig(); static void initLogging(const char* path); static void setLogLevel(logLevel_t l); static void setBufferLimit(uint64_t l); static uint64_t getBufferLimit(); + static void setSocketTimeout(int32_t l); + static int32_t getSocketTimeout(); static logLevel_t getLogLevel(); private: // The logging level @@ -94,7 +95,9 @@ class DECLSPEC_DRILL_CLIENT DrillClientConfig{ // The total amount of memory to be allocated by an instance of DrillClient. // For future use. Currently, not enforced. static uint64_t s_bufferLimit; - static boost::mutex s_mutex; + // Timeout (in seconds) for asynchronous read operations. Default is 180 seconds + static int32_t s_socketTimeout; + static boost::mutex s_mutex; }; @@ -104,8 +107,8 @@ class DECLSPEC_DRILL_CLIENT DrillClientConfig{ typedef void* QueryHandle_t; /* - * Query Results listener callback. This function is called for every record batch after it has - * been received and decoded. The listener function should return a status. + * Query Results listener callback. This function is called for every record batch after it has + * been received and decoded. The listener function should return a status. * If the listener returns failure, the query will be canceled. * * DrillClientQueryResult will hold a listener & listener contxt for the call back function @@ -114,13 +117,13 @@ typedef status_t (*pfnQueryResultsListener)(QueryHandle_t ctx, RecordBatch* b, D /* * The schema change listener callback. This function is called if the record batch detects a - * change in the schema. The client application can call getColDefs in the RecordIterator or + * change in the schema. The client application can call getColDefs in the RecordIterator or * get the field information from the RecordBatch itself and handle the change appropriately. */ -typedef uint32_t (*pfnSchemaListener)(void* ctx, SchemaDef* s, DrillClientError* err); +typedef status_t (*pfnSchemaListener)(void* ctx, FieldDefPtr f, DrillClientError* err); -/* - * A Record Iterator instance is returned by the SubmitQuery class. Calls block until some data +/* + * A Record Iterator instance is returned by the SubmitQuery class. Calls block until some data * is available, or until all data has been returned. */ @@ -129,12 +132,12 @@ class DECLSPEC_DRILL_CLIENT RecordIterator{ public: ~RecordIterator(); - /* - * Returns a vector of column(i.e. field) definitions. The returned reference is guaranteed to be valid till the - * end of the query or until a schema change event is received. If a schema change event is received by the - * application, the application should discard the reference it currently holds and call this function again. + /* + * Returns a vector of column(i.e. field) definitions. The returned reference is guaranteed to be valid till the + * end of the query or until a schema change event is received. If a schema change event is received by the + * application, the application should discard the reference it currently holds and call this function again. */ - std::vector<Drill::FieldMetadata*>& getColDefs(); + FieldDefPtr getColDefs(); /* Move the current pointer to the next record. */ status_t next(); @@ -148,26 +151,29 @@ class DECLSPEC_DRILL_CLIENT RecordIterator{ /* Cancels the query. */ status_t cancel(); - void registerSchemaChangeListener(pfnSchemaListener* l); + /* Returns true is the schem has changed from the previous record. Returns false for the first record. */ + bool hasSchemaChanged(); + + void registerSchemaChangeListener(pfnSchemaListener l); /* * Returns the last error message */ - std::string& getError(); + const std::string& getError(); private: RecordIterator(DrillClientQueryResult* pResult){ this->m_currentRecord=-1; this->m_pCurrentRecordBatch=NULL; this->m_pQueryResult=pResult; - m_pColDefs=NULL; + //m_pColDefs=NULL; } DrillClientQueryResult* m_pQueryResult; size_t m_currentRecord; RecordBatch* m_pCurrentRecordBatch; - boost::mutex m_recordBatchMutex; - std::vector<Drill::FieldMetadata*>* m_pColDefs; // Copy of the latest column defs made from the + boost::mutex m_recordBatchMutex; + FieldDefPtr m_pColDefs; // Copy of the latest column defs made from the // first record batch with this definition }; @@ -189,19 +195,19 @@ class DECLSPEC_DRILL_CLIENT DrillClient{ void close() ; /* - * Submit a query asynchronously and wait for results to be returned thru a callback. A query context handle is passed + * Submit a query asynchronously and wait for results to be returned thru a callback. A query context handle is passed * back. The listener callback will return the handle in the ctx parameter. */ - status_t submitQuery(exec::user::QueryType t, const std::string& plan, pfnQueryResultsListener listener, void* listenerCtx, QueryHandle_t* qHandle); + status_t submitQuery(::exec::shared::QueryType t, const std::string& plan, pfnQueryResultsListener listener, void* listenerCtx, QueryHandle_t* qHandle); /* * Submit a query asynchronously and wait for results to be returned thru an iterator that returns * results synchronously. The client app needs to call delete on the iterator when done. */ - RecordIterator* submitQuery(exec::user::QueryType t, const std::string& plan, DrillClientError* err); + RecordIterator* submitQuery(::exec::shared::QueryType t, const std::string& plan, DrillClientError* err); - /* - * The client application should call this function to wait for results if it has registered a + /* + * The client application should call this function to wait for results if it has registered a * listener. */ void waitForResults(); @@ -212,10 +218,21 @@ class DECLSPEC_DRILL_CLIENT DrillClient{ std::string& getError(); /* - * Applications using the async query submit method should call freeQueryResources to free up resources + * Applications using the async query submit method can register a listener for schema changes + * + */ + void registerSchemaChangeListener(QueryHandle_t* handle, pfnSchemaListener l); + + /* + * Applications using the async query submit method should call freeQueryResources to free up resources * once the query is no longer being processed. - * */ + */ void freeQueryResources(QueryHandle_t* handle); + + /* + * Applications using the sync query submit method should call freeQueryIterator to free up resources + * once the RecordIterator is no longer being processed. + */ void freeQueryIterator(RecordIterator** pIter){ delete *pIter; *pIter=NULL;}; private: diff --git a/contrib/native/client/src/include/drill/protobuf/User.pb.h b/contrib/native/client/src/include/drill/protobuf/User.pb.h index 3ed024963..982d34fbd 100644 --- a/contrib/native/client/src/include/drill/protobuf/User.pb.h +++ b/contrib/native/client/src/include/drill/protobuf/User.pb.h @@ -96,26 +96,6 @@ inline bool RpcType_Parse( return ::google::protobuf::internal::ParseNamedEnum<RpcType>( RpcType_descriptor(), name, value); } -enum QueryType { - SQL = 1, - LOGICAL = 2, - PHYSICAL = 3 -}; -bool QueryType_IsValid(int value); -const QueryType QueryType_MIN = SQL; -const QueryType QueryType_MAX = PHYSICAL; -const int QueryType_ARRAYSIZE = QueryType_MAX + 1; - -const ::google::protobuf::EnumDescriptor* QueryType_descriptor(); -inline const ::std::string& QueryType_Name(QueryType value) { - return ::google::protobuf::internal::NameOfEnum( - QueryType_descriptor(), value); -} -inline bool QueryType_Parse( - const ::std::string& name, QueryType* value) { - return ::google::protobuf::internal::ParseNamedEnum<QueryType>( - QueryType_descriptor(), name, value); -} enum QueryResultsMode { STREAM_FULL = 1 }; @@ -604,12 +584,12 @@ class RunQuery : public ::google::protobuf::Message { inline ::exec::user::QueryResultsMode results_mode() const; inline void set_results_mode(::exec::user::QueryResultsMode value); - // optional .exec.user.QueryType type = 2; + // optional .exec.shared.QueryType type = 2; inline bool has_type() const; inline void clear_type(); static const int kTypeFieldNumber = 2; - inline ::exec::user::QueryType type() const; - inline void set_type(::exec::user::QueryType value); + inline ::exec::shared::QueryType type() const; + inline void set_type(::exec::shared::QueryType value); // optional string plan = 3; inline bool has_plan() const; @@ -1456,7 +1436,7 @@ inline void RunQuery::set_results_mode(::exec::user::QueryResultsMode value) { results_mode_ = value; } -// optional .exec.user.QueryType type = 2; +// optional .exec.shared.QueryType type = 2; inline bool RunQuery::has_type() const { return (_has_bits_[0] & 0x00000002u) != 0; } @@ -1470,11 +1450,11 @@ inline void RunQuery::clear_type() { type_ = 1; clear_has_type(); } -inline ::exec::user::QueryType RunQuery::type() const { - return static_cast< ::exec::user::QueryType >(type_); +inline ::exec::shared::QueryType RunQuery::type() const { + return static_cast< ::exec::shared::QueryType >(type_); } -inline void RunQuery::set_type(::exec::user::QueryType value) { - assert(::exec::user::QueryType_IsValid(value)); +inline void RunQuery::set_type(::exec::shared::QueryType value) { + assert(::exec::shared::QueryType_IsValid(value)); set_has_type(); type_ = value; } @@ -1927,10 +1907,6 @@ inline const EnumDescriptor* GetEnumDescriptor< ::exec::user::RpcType>() { return ::exec::user::RpcType_descriptor(); } template <> -inline const EnumDescriptor* GetEnumDescriptor< ::exec::user::QueryType>() { - return ::exec::user::QueryType_descriptor(); -} -template <> inline const EnumDescriptor* GetEnumDescriptor< ::exec::user::QueryResultsMode>() { return ::exec::user::QueryResultsMode_descriptor(); } diff --git a/contrib/native/client/src/include/drill/recordBatch.hpp b/contrib/native/client/src/include/drill/recordBatch.hpp index c40327bfd..4ed1e3139 100644 --- a/contrib/native/client/src/include/drill/recordBatch.hpp +++ b/contrib/native/client/src/include/drill/recordBatch.hpp @@ -21,6 +21,7 @@ #include <assert.h> +#include <math.h> #include <stdint.h> #include <stdio.h> #include <ostream> @@ -45,7 +46,7 @@ #if __GNUC__ >= 4 #define DECLSPEC_DRILL_CLIENT __attribute__ ((visibility ("default"))) #else - #define DECLSPEC_DRILL_CLIENT + #define DECLSPEC_DRILL_CLIENT #endif #endif @@ -55,7 +56,7 @@ namespace Drill { class FieldBatch; class ValueVectorBase; -//TODO: The base classes for value vectors should have abstract functions instead of implementations +//TODO: The base classes for value vectors should have abstract functions instead of implementations //that return 'NOT IMPLEMENTED YET' // A Read Only Sliced byte buffer @@ -111,7 +112,7 @@ class SlicedByteBuf{ ByteBuf_t getSliceStart(){ return this->m_buffer+this->m_start;} // accessor functions - // + // // TYPE getTYPE(size_t index){ // if(index>=m_length) return 0; // return (TYPE) m_buffer[offset+index]; @@ -122,8 +123,8 @@ class SlicedByteBuf{ // Type T can only be an integer type // Type T cannot be a struct of fixed size // Because struct alignment is compiler dependent - // we can end up with a struct size that is larger - // than the buffer in the sliced buf. + // we can end up with a struct size that is larger + // than the buffer in the sliced buf. assert((index + sizeof(T) <= this->m_length)); if(index + sizeof(T) <= this->m_length) return *((T*)(this->m_buffer+this->m_start+index)); @@ -145,7 +146,7 @@ class SlicedByteBuf{ ByteBuf_t getAt(size_t index){ return this->m_buffer+m_start+index; - } + } bool getBit(size_t index){ // refer to BitVector.java http://bit.ly/Py1jof @@ -202,7 +203,7 @@ class DECLSPEC_DRILL_CLIENT ValueVectorUnimplemented:public ValueVectorBase{ const char* get(size_t index) const { return 0;}; virtual void getValueAt(size_t index, char* buf, size_t nChars) const{ *buf=0; return; - } + } virtual uint32_t getSize(size_t index) const{ return 0;}; @@ -284,7 +285,7 @@ class DECLSPEC_DRILL_CLIENT ValueVectorBit:public ValueVectorFixedWidth{ template <int DECIMAL_DIGITS, int WIDTH_IN_BYTES, bool IS_SPARSE, int MAX_PRECISION = 0 > class ValueVectorDecimal: public ValueVectorFixedWidth { public: - ValueVectorDecimal(SlicedByteBuf* b, size_t rowCount, int32_t scale): + ValueVectorDecimal(SlicedByteBuf* b, size_t rowCount, int32_t scale): ValueVectorFixedWidth(b, rowCount), m_scale(scale) { @@ -319,7 +320,7 @@ template <int DECIMAL_DIGITS, int WIDTH_IN_BYTES, bool IS_SPARSE, int MAX_PRECIS template<typename VALUE_TYPE> class ValueVectorDecimalTrivial: public ValueVectorFixedWidth { public: - ValueVectorDecimalTrivial(SlicedByteBuf* b, size_t rowCount, int32_t scale): + ValueVectorDecimalTrivial(SlicedByteBuf* b, size_t rowCount, int32_t scale): ValueVectorFixedWidth(b, rowCount), m_scale(scale) { @@ -329,7 +330,7 @@ template<typename VALUE_TYPE> DecimalValue get(size_t index) const { return DecimalValue( m_pBuffer->readAt<VALUE_TYPE>(index * sizeof(VALUE_TYPE)), - m_scale); + m_scale); } void getValueAt(size_t index, char* buf, size_t nChars) const { @@ -355,7 +356,7 @@ template <typename VALUE_TYPE> { public: NullableValueVectorFixed(SlicedByteBuf *b, size_t rowCount):ValueVectorBase(b, rowCount){ - size_t offsetEnd = rowCount/8 + 1; + size_t offsetEnd = (size_t)ceil(rowCount/8.0); this->m_pBitmap= new SlicedByteBuf(*b, 0, offsetEnd); this->m_pData= new SlicedByteBuf(*b, offsetEnd, b->getLength()); // TODO: testing boundary case(null columns) @@ -372,7 +373,7 @@ template <typename VALUE_TYPE> } VALUE_TYPE get(size_t index) const { - // it should not be called if the value is null + // it should not be called if the value is null assert( "value is null" && !isNull(index)); return m_pData->readAt<VALUE_TYPE>(index * sizeof(VALUE_TYPE)); } @@ -390,14 +391,14 @@ template <typename VALUE_TYPE> return sizeof(VALUE_TYPE); } private: - SlicedByteBuf* m_pBitmap; + SlicedByteBuf* m_pBitmap; SlicedByteBuf* m_pData; }; // The 'holder' classes are (by contract) simple structs with primitive members and no dynamic allocations. -// The template classes create an instance of the class and return it to the caller in the 'get' routines. -// The compiler will create a copy and return it to the caller. If the object is more complex than a struct of -// primitives, the class _must_ provide a copy constructor. +// The template classes create an instance of the class and return it to the caller in the 'get' routines. +// The compiler will create a copy and return it to the caller. If the object is more complex than a struct of +// primitives, the class _must_ provide a copy constructor. // We don't really need a destructor here, but we declare a virtual dtor in the base class in case we ever get // more complex and start doing dynamic allocations in these classes. @@ -490,11 +491,11 @@ struct IntervalHolder{ }; /* - * VALUEHOLDER_CLASS_TYPE is a struct with a constructor that takes a parameter of type VALUE_VECTOR_TYPE + * VALUEHOLDER_CLASS_TYPE is a struct with a constructor that takes a parameter of type VALUE_VECTOR_TYPE * (a primitive type) * VALUEHOLDER_CLASS_TYPE implements a toString function - * Note that VALUEHOLDER_CLASS_TYPE is created on the stack and the copy returned in the get function. - * So the class needs to have the appropriate copy constructor or the default bitwise copy should work + * Note that VALUEHOLDER_CLASS_TYPE is created on the stack and the copy returned in the get function. + * So the class needs to have the appropriate copy constructor or the default bitwise copy should work * correctly. */ template <class VALUEHOLDER_CLASS_TYPE, typename VALUE_TYPE> @@ -552,7 +553,7 @@ template <class VALUEHOLDER_CLASS_TYPE, class VALUE_VECTOR_TYPE> public: NullableValueVectorTyped(SlicedByteBuf *b, size_t rowCount):ValueVectorBase(b, rowCount){ - size_t offsetEnd = rowCount/8 + 1; + size_t offsetEnd = (size_t)ceil(rowCount/8.0); this->m_pBitmap= new SlicedByteBuf(*b, 0, offsetEnd); this->m_pData= new SlicedByteBuf(*b, offsetEnd, b->getLength()-offsetEnd); this->m_pVector= new VALUE_VECTOR_TYPE(m_pData, rowCount); @@ -575,7 +576,7 @@ template <class VALUEHOLDER_CLASS_TYPE, class VALUE_VECTOR_TYPE> void getValueAt(size_t index, char* buf, size_t nChars) const{ std::stringstream sstr; - if(this->isNull(index)){ + if(this->isNull(index)){ sstr<<"NULL"; strncpy(buf, sstr.str().c_str(), nChars); }else{ @@ -589,7 +590,7 @@ template <class VALUEHOLDER_CLASS_TYPE, class VALUE_VECTOR_TYPE> } private: - SlicedByteBuf* m_pBitmap; + SlicedByteBuf* m_pBitmap; SlicedByteBuf* m_pData; VALUE_VECTOR_TYPE* m_pVector; }; @@ -617,10 +618,10 @@ class DECLSPEC_DRILL_CLIENT ValueVectorVarWidth:public ValueVectorBase{ size_t endIdx = this->m_pOffsetArray->getUint32((index+1)*sizeof(uint32_t)); size_t length = endIdx - startIdx; assert(length >= 0); - // Return an object created on the stack. The compiler will return a - // copy and destroy the stack object. The optimizer will hopefully + // Return an object created on the stack. The compiler will return a + // copy and destroy the stack object. The optimizer will hopefully // elide this so we can return an object with no extra memory allocation - // and no copies.(SEE: http://en.wikipedia.org/wiki/Return_value_optimization) + // and no copies.(SEE: http://en.wikipedia.org/wiki/Return_value_optimization) VarWidthHolder dst; dst.data=this->m_pData->getSliceStart()+startIdx; dst.size=length; @@ -673,9 +674,9 @@ class DECLSPEC_DRILL_CLIENT ValueVectorVarBinary:public ValueVectorVarWidth{ } }; // -//TODO: For windows, we have to export instantiations of the template class. +//TODO: For windows, we have to export instantiations of the template class. //see: http://msdn.microsoft.com/en-us/library/twa2aw10.aspx -//for example: +//for example: //template class __declspec(dllexport) B<int>; //class __declspec(dllexport) D : public B<int> { } // @@ -686,7 +687,7 @@ typedef NullableValueVectorTyped<int, ValueVectorBit > NullableValueVectorBit; // Aliases for Decimal Types: // The definitions for decimal digits, width, max precision are defined in // /exec/java-exec/src/main/codegen/data/ValueVectorTypes.tdd -// +// // Decimal9 and Decimal18 could be optimized, maybe write seperate classes? typedef ValueVectorDecimalTrivial<int32_t> ValueVectorDecimal9; typedef ValueVectorDecimalTrivial<int64_t> ValueVectorDecimal18; @@ -778,7 +779,7 @@ class FieldBatch{ ret_t load(); const ValueVectorBase * getVector(){ - return m_pValueVector; + return m_pValueVector; } private: @@ -795,33 +796,27 @@ class ValueVectorFactory{ class DECLSPEC_DRILL_CLIENT RecordBatch{ public: - RecordBatch(exec::user::QueryResult* pResult, ByteBuf_t b){ - m_pQueryResult=pResult; + + //m_allocatedBuffer is the memory block allocated to hold the incoming RPC message. Record BAtches operate on + //slices of the allcoated buffer. The first slice (the first Field Batch), begins at m_buffer. Data in the + //allocated buffer before m_buffer is mostly the RPC header, and the QueryResult object. + RecordBatch(exec::user::QueryResult* pResult, ByteBuf_t r, ByteBuf_t b) + :m_fieldDefs(new(std::vector<Drill::FieldMetadata*>)){ + m_pQueryResult=pResult; m_pRecordBatchDef=&pResult->def(); m_numRecords=pResult->row_count(); + m_allocatedBuffer=r; m_buffer=b; m_numFields=pResult->def().field_size(); m_bHasSchemaChanged=false; } - ~RecordBatch(){ - m_buffer=NULL; - //free memory allocated for FieldBatch objects saved in m_fields; - for(std::vector<FieldBatch*>::iterator it = m_fields.begin(); it != m_fields.end(); ++it){ - delete *it; - } - m_fields.clear(); - for(std::vector<Drill::FieldMetadata*>::iterator it = m_fieldDefs.begin(); it != m_fieldDefs.end(); ++it){ - delete *it; - } - m_fieldDefs.clear(); - delete m_pQueryResult; - } + ~RecordBatch(); // get the ith field metadata const Drill::FieldMetadata& getFieldMetadata(size_t index){ //return this->m_pRecordBatchDef->field(index); - return *(m_fieldDefs[index]); + return *(m_fieldDefs->at(index)); } size_t getNumRecords(){ return m_numRecords;} @@ -829,13 +824,13 @@ class DECLSPEC_DRILL_CLIENT RecordBatch{ size_t getNumFields() { return m_pRecordBatchDef->field_size(); } bool isLastChunk() { return m_pQueryResult->is_last_chunk(); } - std::vector<Drill::FieldMetadata*>& getColumnDefs(){ return m_fieldDefs;} + boost::shared_ptr<std::vector<Drill::FieldMetadata*> > getColumnDefs(){ return m_fieldDefs;} - // + // // build the record batch: i.e. fill up the value vectors from the buffer. - // On fetching the data from the server, the caller creates a RecordBatch - // object then calls build() to build the value vectors.The caller saves the - // Record Batch and is responsible for freeing both the RecordBatch and the + // On fetching the data from the server, the caller creates a RecordBatch + // object then calls build() to build the value vectors.The caller saves the + // Record Batch and is responsible for freeing both the RecordBatch and the // raw buffer memory // ret_t build(); @@ -843,7 +838,7 @@ class DECLSPEC_DRILL_CLIENT RecordBatch{ void print(std::ostream& s, size_t num); const ValueVectorBase * getVector(size_t index){ - return m_fields[index]->getVector(); + return m_fields[index]->getVector(); } void schemaChanged(bool b){ @@ -858,9 +853,10 @@ class DECLSPEC_DRILL_CLIENT RecordBatch{ private: const exec::user::QueryResult* m_pQueryResult; const exec::shared::RecordBatchDef* m_pRecordBatchDef; + ByteBuf_t m_allocatedBuffer; ByteBuf_t m_buffer; //build the current schema out of the field metadata - std::vector<Drill::FieldMetadata*> m_fieldDefs; + FieldDefPtr m_fieldDefs; std::vector<FieldBatch*> m_fields; size_t m_numFields; size_t m_numRecords; diff --git a/contrib/native/client/src/protobuf/BitControl.pb.cc b/contrib/native/client/src/protobuf/BitControl.pb.cc index 6e0e325a2..de6a9ca90 100644 --- a/contrib/native/client/src/protobuf/BitControl.pb.cc +++ b/contrib/native/client/src/protobuf/BitControl.pb.cc @@ -31,7 +31,6 @@ const ::google::protobuf::internal::GeneratedMessageReflection* const ::google::protobuf::Descriptor* FragmentStatus_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* FragmentStatus_reflection_ = NULL; -const ::google::protobuf::EnumDescriptor* FragmentStatus_FragmentState_descriptor_ = NULL; const ::google::protobuf::Descriptor* PlanFragment_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* PlanFragment_reflection_ = NULL; @@ -82,16 +81,9 @@ void protobuf_AssignDesc_BitControl_2eproto() { ::google::protobuf::MessageFactory::generated_factory(), sizeof(BitStatus)); FragmentStatus_descriptor_ = file->message_type(2); - static const int FragmentStatus_offsets_[9] = { - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FragmentStatus, memory_use_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FragmentStatus, batches_completed_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FragmentStatus, records_completed_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FragmentStatus, estimated_completion_percentage_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FragmentStatus, state_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FragmentStatus, data_processed_), + static const int FragmentStatus_offsets_[2] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FragmentStatus, profile_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FragmentStatus, handle_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FragmentStatus, error_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FragmentStatus, running_time_), }; FragmentStatus_reflection_ = new ::google::protobuf::internal::GeneratedMessageReflection( @@ -104,7 +96,6 @@ void protobuf_AssignDesc_BitControl_2eproto() { ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(FragmentStatus)); - FragmentStatus_FragmentState_descriptor_ = FragmentStatus_descriptor_->enum_type(0); PlanFragment_descriptor_ = file->message_type(3); static const int PlanFragment_offsets_[15] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PlanFragment, handle_), @@ -208,39 +199,31 @@ void protobuf_AddDesc_BitControl_2eproto() { "(\0162\027.exec.shared.RpcChannel:\013BIT_CONTROL" "\022(\n\010endpoint\030\003 \001(\0132\026.exec.DrillbitEndpoi" "nt\"F\n\tBitStatus\0229\n\017fragment_status\030\001 \003(\013" - "2 .exec.bit.control.FragmentStatus\"\261\003\n\016F" - "ragmentStatus\022\022\n\nmemory_use\030\001 \001(\003\022\031\n\021bat" - "ches_completed\030\002 \001(\003\022\031\n\021records_complete" - "d\030\003 \001(\003\022\'\n\037estimated_completion_percenta" - "ge\030\004 \001(\005\022=\n\005state\030\005 \001(\0162..exec.bit.contr" - "ol.FragmentStatus.FragmentState\022\026\n\016data_" - "processed\030\006 \001(\003\022(\n\006handle\030\007 \001(\0132\030.exec.b" - "it.FragmentHandle\022(\n\005error\030\010 \001(\0132\031.exec." - "shared.DrillPBError\022\024\n\014running_time\030\t \001(" - "\003\"k\n\rFragmentState\022\013\n\007SENDING\020\000\022\027\n\023AWAIT" - "ING_ALLOCATION\020\001\022\013\n\007RUNNING\020\002\022\014\n\010FINISHE" - "D\020\003\022\r\n\tCANCELLED\020\004\022\n\n\006FAILED\020\005\"\276\003\n\014PlanF" - "ragment\022(\n\006handle\030\001 \001(\0132\030.exec.bit.Fragm" - "entHandle\022\024\n\014network_cost\030\004 \001(\002\022\020\n\010cpu_c" - "ost\030\005 \001(\002\022\021\n\tdisk_cost\030\006 \001(\002\022\023\n\013memory_c" - "ost\030\007 \001(\002\022\025\n\rfragment_json\030\010 \001(\t\022*\n\nassi" - "gnment\030\n \001(\0132\026.exec.DrillbitEndpoint\022\025\n\r" - "leaf_fragment\030\t \001(\010\022\'\n\007foreman\030\013 \001(\0132\026.e" - "xec.DrillbitEndpoint\022\035\n\013mem_initial\030\014 \001(" - "\003:\01020000000\022\034\n\007mem_max\030\r \001(\003:\0132000000000" - "0\022\030\n\020query_start_time\030\016 \001(\003\0221\n\013credentia" - "ls\030\017 \001(\0132\034.exec.shared.UserCredentials\022\021" - "\n\ttime_zone\030\020 \001(\005\022\024\n\014options_json\030\021 \001(\t\"" - "f\n\017WorkQueueStatus\022(\n\010endpoint\030\001 \001(\0132\026.e" - "xec.DrillbitEndpoint\022\024\n\014queue_length\030\002 \001" - "(\005\022\023\n\013report_time\030\003 \001(\003*\332\001\n\007RpcType\022\r\n\tH" - "ANDSHAKE\020\000\022\007\n\003ACK\020\001\022\013\n\007GOODBYE\020\002\022\033\n\027REQ_" - "INIATILIZE_FRAGMENT\020\003\022\027\n\023REQ_CANCEL_FRAG" - "MENT\020\006\022\027\n\023REQ_FRAGMENT_STATUS\020\007\022\022\n\016REQ_B" - "IT_STATUS\020\010\022\030\n\024RESP_FRAGMENT_HANDLE\020\t\022\030\n" - "\024RESP_FRAGMENT_STATUS\020\n\022\023\n\017RESP_BIT_STAT" - "US\020\013B+\n\033org.apache.drill.exec.protoB\nBit" - "ControlH\001", 1569); + "2 .exec.bit.control.FragmentStatus\"n\n\016Fr" + "agmentStatus\0222\n\007profile\030\001 \001(\0132!.exec.sha" + "red.MinorFragmentProfile\022(\n\006handle\030\002 \001(\013" + "2\030.exec.bit.FragmentHandle\"\276\003\n\014PlanFragm" + "ent\022(\n\006handle\030\001 \001(\0132\030.exec.bit.FragmentH" + "andle\022\024\n\014network_cost\030\004 \001(\002\022\020\n\010cpu_cost\030" + "\005 \001(\002\022\021\n\tdisk_cost\030\006 \001(\002\022\023\n\013memory_cost\030" + "\007 \001(\002\022\025\n\rfragment_json\030\010 \001(\t\022*\n\nassignme" + "nt\030\n \001(\0132\026.exec.DrillbitEndpoint\022\025\n\rleaf" + "_fragment\030\t \001(\010\022\'\n\007foreman\030\013 \001(\0132\026.exec." + "DrillbitEndpoint\022\035\n\013mem_initial\030\014 \001(\003:\0102" + "0000000\022\034\n\007mem_max\030\r \001(\003:\01320000000000\022\030\n" + "\020query_start_time\030\016 \001(\003\0221\n\013credentials\030\017" + " \001(\0132\034.exec.shared.UserCredentials\022\021\n\tti" + "me_zone\030\020 \001(\005\022\024\n\014options_json\030\021 \001(\t\"f\n\017W" + "orkQueueStatus\022(\n\010endpoint\030\001 \001(\0132\026.exec." + "DrillbitEndpoint\022\024\n\014queue_length\030\002 \001(\005\022\023" + "\n\013report_time\030\003 \001(\003*\332\001\n\007RpcType\022\r\n\tHANDS" + "HAKE\020\000\022\007\n\003ACK\020\001\022\013\n\007GOODBYE\020\002\022\033\n\027REQ_INIA" + "TILIZE_FRAGMENT\020\003\022\027\n\023REQ_CANCEL_FRAGMENT" + "\020\006\022\027\n\023REQ_FRAGMENT_STATUS\020\007\022\022\n\016REQ_BIT_S" + "TATUS\020\010\022\030\n\024RESP_FRAGMENT_HANDLE\020\t\022\030\n\024RES" + "P_FRAGMENT_STATUS\020\n\022\023\n\017RESP_BIT_STATUS\020\013" + "B+\n\033org.apache.drill.exec.protoB\nBitCont" + "rolH\001", 1245); ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "BitControl.proto", &protobuf_RegisterTypes); BitControlHandshake::default_instance_ = new BitControlHandshake(); @@ -789,45 +772,9 @@ void BitStatus::Swap(BitStatus* other) { // =================================================================== -const ::google::protobuf::EnumDescriptor* FragmentStatus_FragmentState_descriptor() { - protobuf_AssignDescriptorsOnce(); - return FragmentStatus_FragmentState_descriptor_; -} -bool FragmentStatus_FragmentState_IsValid(int value) { - switch(value) { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - return true; - default: - return false; - } -} - -#ifndef _MSC_VER -const FragmentStatus_FragmentState FragmentStatus::SENDING; -const FragmentStatus_FragmentState FragmentStatus::AWAITING_ALLOCATION; -const FragmentStatus_FragmentState FragmentStatus::RUNNING; -const FragmentStatus_FragmentState FragmentStatus::FINISHED; -const FragmentStatus_FragmentState FragmentStatus::CANCELLED; -const FragmentStatus_FragmentState FragmentStatus::FAILED; -const FragmentStatus_FragmentState FragmentStatus::FragmentState_MIN; -const FragmentStatus_FragmentState FragmentStatus::FragmentState_MAX; -const int FragmentStatus::FragmentState_ARRAYSIZE; -#endif // _MSC_VER #ifndef _MSC_VER -const int FragmentStatus::kMemoryUseFieldNumber; -const int FragmentStatus::kBatchesCompletedFieldNumber; -const int FragmentStatus::kRecordsCompletedFieldNumber; -const int FragmentStatus::kEstimatedCompletionPercentageFieldNumber; -const int FragmentStatus::kStateFieldNumber; -const int FragmentStatus::kDataProcessedFieldNumber; +const int FragmentStatus::kProfileFieldNumber; const int FragmentStatus::kHandleFieldNumber; -const int FragmentStatus::kErrorFieldNumber; -const int FragmentStatus::kRunningTimeFieldNumber; #endif // !_MSC_VER FragmentStatus::FragmentStatus() @@ -836,8 +783,8 @@ FragmentStatus::FragmentStatus() } void FragmentStatus::InitAsDefaultInstance() { + profile_ = const_cast< ::exec::shared::MinorFragmentProfile*>(&::exec::shared::MinorFragmentProfile::default_instance()); handle_ = const_cast< ::exec::bit::FragmentHandle*>(&::exec::bit::FragmentHandle::default_instance()); - error_ = const_cast< ::exec::shared::DrillPBError*>(&::exec::shared::DrillPBError::default_instance()); } FragmentStatus::FragmentStatus(const FragmentStatus& from) @@ -848,15 +795,8 @@ FragmentStatus::FragmentStatus(const FragmentStatus& from) void FragmentStatus::SharedCtor() { _cached_size_ = 0; - memory_use_ = GOOGLE_LONGLONG(0); - batches_completed_ = GOOGLE_LONGLONG(0); - records_completed_ = GOOGLE_LONGLONG(0); - estimated_completion_percentage_ = 0; - state_ = 0; - data_processed_ = GOOGLE_LONGLONG(0); + profile_ = NULL; handle_ = NULL; - error_ = NULL; - running_time_ = GOOGLE_LONGLONG(0); ::memset(_has_bits_, 0, sizeof(_has_bits_)); } @@ -866,8 +806,8 @@ FragmentStatus::~FragmentStatus() { void FragmentStatus::SharedDtor() { if (this != default_instance_) { + delete profile_; delete handle_; - delete error_; } } @@ -894,21 +834,12 @@ FragmentStatus* FragmentStatus::New() const { void FragmentStatus::Clear() { if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - memory_use_ = GOOGLE_LONGLONG(0); - batches_completed_ = GOOGLE_LONGLONG(0); - records_completed_ = GOOGLE_LONGLONG(0); - estimated_completion_percentage_ = 0; - state_ = 0; - data_processed_ = GOOGLE_LONGLONG(0); + if (has_profile()) { + if (profile_ != NULL) profile_->::exec::shared::MinorFragmentProfile::Clear(); + } if (has_handle()) { if (handle_ != NULL) handle_->::exec::bit::FragmentHandle::Clear(); } - if (has_error()) { - if (error_ != NULL) error_->::exec::shared::DrillPBError::Clear(); - } - } - if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) { - running_time_ = GOOGLE_LONGLONG(0); } ::memset(_has_bits_, 0, sizeof(_has_bits_)); mutable_unknown_fields()->Clear(); @@ -920,109 +851,22 @@ bool FragmentStatus::MergePartialFromCodedStream( ::google::protobuf::uint32 tag; while ((tag = input->ReadTag()) != 0) { switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional int64 memory_use = 1; + // optional .exec.shared.MinorFragmentProfile profile = 1; case 1: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( - input, &memory_use_))); - set_has_memory_use(); + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_profile())); } else { goto handle_uninterpreted; } - if (input->ExpectTag(16)) goto parse_batches_completed; + if (input->ExpectTag(18)) goto parse_handle; break; } - // optional int64 batches_completed = 2; + // optional .exec.bit.FragmentHandle handle = 2; case 2: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { - parse_batches_completed: - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( - input, &batches_completed_))); - set_has_batches_completed(); - } else { - goto handle_uninterpreted; - } - if (input->ExpectTag(24)) goto parse_records_completed; - break; - } - - // optional int64 records_completed = 3; - case 3: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { - parse_records_completed: - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( - input, &records_completed_))); - set_has_records_completed(); - } else { - goto handle_uninterpreted; - } - if (input->ExpectTag(32)) goto parse_estimated_completion_percentage; - break; - } - - // optional int32 estimated_completion_percentage = 4; - case 4: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { - parse_estimated_completion_percentage: - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( - input, &estimated_completion_percentage_))); - set_has_estimated_completion_percentage(); - } else { - goto handle_uninterpreted; - } - if (input->ExpectTag(40)) goto parse_state; - break; - } - - // optional .exec.bit.control.FragmentStatus.FragmentState state = 5; - case 5: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { - parse_state: - int value; - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( - input, &value))); - if (::exec::bit::control::FragmentStatus_FragmentState_IsValid(value)) { - set_state(static_cast< ::exec::bit::control::FragmentStatus_FragmentState >(value)); - } else { - mutable_unknown_fields()->AddVarint(5, value); - } - } else { - goto handle_uninterpreted; - } - if (input->ExpectTag(48)) goto parse_data_processed; - break; - } - - // optional int64 data_processed = 6; - case 6: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { - parse_data_processed: - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( - input, &data_processed_))); - set_has_data_processed(); - } else { - goto handle_uninterpreted; - } - if (input->ExpectTag(58)) goto parse_handle; - break; - } - - // optional .exec.bit.FragmentHandle handle = 7; - case 7: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_handle: DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( @@ -1030,36 +874,6 @@ bool FragmentStatus::MergePartialFromCodedStream( } else { goto handle_uninterpreted; } - if (input->ExpectTag(66)) goto parse_error; - break; - } - - // optional .exec.shared.DrillPBError error = 8; - case 8: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - parse_error: - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, mutable_error())); - } else { - goto handle_uninterpreted; - } - if (input->ExpectTag(72)) goto parse_running_time; - break; - } - - // optional int64 running_time = 9; - case 9: { - if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { - parse_running_time: - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( - input, &running_time_))); - set_has_running_time(); - } else { - goto handle_uninterpreted; - } if (input->ExpectAtEnd()) return true; break; } @@ -1082,52 +896,16 @@ bool FragmentStatus::MergePartialFromCodedStream( void FragmentStatus::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { - // optional int64 memory_use = 1; - if (has_memory_use()) { - ::google::protobuf::internal::WireFormatLite::WriteInt64(1, this->memory_use(), output); - } - - // optional int64 batches_completed = 2; - if (has_batches_completed()) { - ::google::protobuf::internal::WireFormatLite::WriteInt64(2, this->batches_completed(), output); - } - - // optional int64 records_completed = 3; - if (has_records_completed()) { - ::google::protobuf::internal::WireFormatLite::WriteInt64(3, this->records_completed(), output); - } - - // optional int32 estimated_completion_percentage = 4; - if (has_estimated_completion_percentage()) { - ::google::protobuf::internal::WireFormatLite::WriteInt32(4, this->estimated_completion_percentage(), output); - } - - // optional .exec.bit.control.FragmentStatus.FragmentState state = 5; - if (has_state()) { - ::google::protobuf::internal::WireFormatLite::WriteEnum( - 5, this->state(), output); - } - - // optional int64 data_processed = 6; - if (has_data_processed()) { - ::google::protobuf::internal::WireFormatLite::WriteInt64(6, this->data_processed(), output); - } - - // optional .exec.bit.FragmentHandle handle = 7; - if (has_handle()) { + // optional .exec.shared.MinorFragmentProfile profile = 1; + if (has_profile()) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 7, this->handle(), output); + 1, this->profile(), output); } - // optional .exec.shared.DrillPBError error = 8; - if (has_error()) { + // optional .exec.bit.FragmentHandle handle = 2; + if (has_handle()) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 8, this->error(), output); - } - - // optional int64 running_time = 9; - if (has_running_time()) { - ::google::protobuf::internal::WireFormatLite::WriteInt64(9, this->running_time(), output); + 2, this->handle(), output); } if (!unknown_fields().empty()) { @@ -1138,54 +916,18 @@ void FragmentStatus::SerializeWithCachedSizes( ::google::protobuf::uint8* FragmentStatus::SerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const { - // optional int64 memory_use = 1; - if (has_memory_use()) { - target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(1, this->memory_use(), target); - } - - // optional int64 batches_completed = 2; - if (has_batches_completed()) { - target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(2, this->batches_completed(), target); - } - - // optional int64 records_completed = 3; - if (has_records_completed()) { - target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(3, this->records_completed(), target); - } - - // optional int32 estimated_completion_percentage = 4; - if (has_estimated_completion_percentage()) { - target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(4, this->estimated_completion_percentage(), target); - } - - // optional .exec.bit.control.FragmentStatus.FragmentState state = 5; - if (has_state()) { - target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray( - 5, this->state(), target); - } - - // optional int64 data_processed = 6; - if (has_data_processed()) { - target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(6, this->data_processed(), target); - } - - // optional .exec.bit.FragmentHandle handle = 7; - if (has_handle()) { + // optional .exec.shared.MinorFragmentProfile profile = 1; + if (has_profile()) { target = ::google::protobuf::internal::WireFormatLite:: WriteMessageNoVirtualToArray( - 7, this->handle(), target); + 1, this->profile(), target); } - // optional .exec.shared.DrillPBError error = 8; - if (has_error()) { + // optional .exec.bit.FragmentHandle handle = 2; + if (has_handle()) { target = ::google::protobuf::internal::WireFormatLite:: WriteMessageNoVirtualToArray( - 8, this->error(), target); - } - - // optional int64 running_time = 9; - if (has_running_time()) { - target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(9, this->running_time(), target); + 2, this->handle(), target); } if (!unknown_fields().empty()) { @@ -1199,70 +941,20 @@ int FragmentStatus::ByteSize() const { int total_size = 0; if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - // optional int64 memory_use = 1; - if (has_memory_use()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::Int64Size( - this->memory_use()); - } - - // optional int64 batches_completed = 2; - if (has_batches_completed()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::Int64Size( - this->batches_completed()); - } - - // optional int64 records_completed = 3; - if (has_records_completed()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::Int64Size( - this->records_completed()); - } - - // optional int32 estimated_completion_percentage = 4; - if (has_estimated_completion_percentage()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::Int32Size( - this->estimated_completion_percentage()); - } - - // optional .exec.bit.control.FragmentStatus.FragmentState state = 5; - if (has_state()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::EnumSize(this->state()); - } - - // optional int64 data_processed = 6; - if (has_data_processed()) { + // optional .exec.shared.MinorFragmentProfile profile = 1; + if (has_profile()) { total_size += 1 + - ::google::protobuf::internal::WireFormatLite::Int64Size( - this->data_processed()); + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->profile()); } - // optional .exec.bit.FragmentHandle handle = 7; + // optional .exec.bit.FragmentHandle handle = 2; if (has_handle()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( this->handle()); } - // optional .exec.shared.DrillPBError error = 8; - if (has_error()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->error()); - } - - } - if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) { - // optional int64 running_time = 9; - if (has_running_time()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::Int64Size( - this->running_time()); - } - } if (!unknown_fields().empty()) { total_size += @@ -1290,35 +982,12 @@ void FragmentStatus::MergeFrom(const ::google::protobuf::Message& from) { void FragmentStatus::MergeFrom(const FragmentStatus& from) { GOOGLE_CHECK_NE(&from, this); if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (from.has_memory_use()) { - set_memory_use(from.memory_use()); - } - if (from.has_batches_completed()) { - set_batches_completed(from.batches_completed()); - } - if (from.has_records_completed()) { - set_records_completed(from.records_completed()); - } - if (from.has_estimated_completion_percentage()) { - set_estimated_completion_percentage(from.estimated_completion_percentage()); - } - if (from.has_state()) { - set_state(from.state()); - } - if (from.has_data_processed()) { - set_data_processed(from.data_processed()); + if (from.has_profile()) { + mutable_profile()->::exec::shared::MinorFragmentProfile::MergeFrom(from.profile()); } if (from.has_handle()) { mutable_handle()->::exec::bit::FragmentHandle::MergeFrom(from.handle()); } - if (from.has_error()) { - mutable_error()->::exec::shared::DrillPBError::MergeFrom(from.error()); - } - } - if (from._has_bits_[8 / 32] & (0xffu << (8 % 32))) { - if (from.has_running_time()) { - set_running_time(from.running_time()); - } } mutable_unknown_fields()->MergeFrom(from.unknown_fields()); } @@ -1342,15 +1011,8 @@ bool FragmentStatus::IsInitialized() const { void FragmentStatus::Swap(FragmentStatus* other) { if (other != this) { - std::swap(memory_use_, other->memory_use_); - std::swap(batches_completed_, other->batches_completed_); - std::swap(records_completed_, other->records_completed_); - std::swap(estimated_completion_percentage_, other->estimated_completion_percentage_); - std::swap(state_, other->state_); - std::swap(data_processed_, other->data_processed_); + std::swap(profile_, other->profile_); std::swap(handle_, other->handle_); - std::swap(error_, other->error_); - std::swap(running_time_, other->running_time_); std::swap(_has_bits_[0], other->_has_bits_[0]); _unknown_fields_.Swap(&other->_unknown_fields_); std::swap(_cached_size_, other->_cached_size_); diff --git a/contrib/native/client/src/protobuf/BitControl.pb.h b/contrib/native/client/src/protobuf/BitControl.pb.h index e26f7c05d..8a7262b97 100644 --- a/contrib/native/client/src/protobuf/BitControl.pb.h +++ b/contrib/native/client/src/protobuf/BitControl.pb.h @@ -45,29 +45,6 @@ class FragmentStatus; class PlanFragment; class WorkQueueStatus; -enum FragmentStatus_FragmentState { - FragmentStatus_FragmentState_SENDING = 0, - FragmentStatus_FragmentState_AWAITING_ALLOCATION = 1, - FragmentStatus_FragmentState_RUNNING = 2, - FragmentStatus_FragmentState_FINISHED = 3, - FragmentStatus_FragmentState_CANCELLED = 4, - FragmentStatus_FragmentState_FAILED = 5 -}; -bool FragmentStatus_FragmentState_IsValid(int value); -const FragmentStatus_FragmentState FragmentStatus_FragmentState_FragmentState_MIN = FragmentStatus_FragmentState_SENDING; -const FragmentStatus_FragmentState FragmentStatus_FragmentState_FragmentState_MAX = FragmentStatus_FragmentState_FAILED; -const int FragmentStatus_FragmentState_FragmentState_ARRAYSIZE = FragmentStatus_FragmentState_FragmentState_MAX + 1; - -const ::google::protobuf::EnumDescriptor* FragmentStatus_FragmentState_descriptor(); -inline const ::std::string& FragmentStatus_FragmentState_Name(FragmentStatus_FragmentState value) { - return ::google::protobuf::internal::NameOfEnum( - FragmentStatus_FragmentState_descriptor(), value); -} -inline bool FragmentStatus_FragmentState_Parse( - const ::std::string& name, FragmentStatus_FragmentState* value) { - return ::google::protobuf::internal::ParseNamedEnum<FragmentStatus_FragmentState>( - FragmentStatus_FragmentState_descriptor(), name, value); -} enum RpcType { HANDSHAKE = 0, ACK = 1, @@ -338,138 +315,40 @@ class FragmentStatus : public ::google::protobuf::Message { // nested types ---------------------------------------------------- - typedef FragmentStatus_FragmentState FragmentState; - static const FragmentState SENDING = FragmentStatus_FragmentState_SENDING; - static const FragmentState AWAITING_ALLOCATION = FragmentStatus_FragmentState_AWAITING_ALLOCATION; - static const FragmentState RUNNING = FragmentStatus_FragmentState_RUNNING; - static const FragmentState FINISHED = FragmentStatus_FragmentState_FINISHED; - static const FragmentState CANCELLED = FragmentStatus_FragmentState_CANCELLED; - static const FragmentState FAILED = FragmentStatus_FragmentState_FAILED; - static inline bool FragmentState_IsValid(int value) { - return FragmentStatus_FragmentState_IsValid(value); - } - static const FragmentState FragmentState_MIN = - FragmentStatus_FragmentState_FragmentState_MIN; - static const FragmentState FragmentState_MAX = - FragmentStatus_FragmentState_FragmentState_MAX; - static const int FragmentState_ARRAYSIZE = - FragmentStatus_FragmentState_FragmentState_ARRAYSIZE; - static inline const ::google::protobuf::EnumDescriptor* - FragmentState_descriptor() { - return FragmentStatus_FragmentState_descriptor(); - } - static inline const ::std::string& FragmentState_Name(FragmentState value) { - return FragmentStatus_FragmentState_Name(value); - } - static inline bool FragmentState_Parse(const ::std::string& name, - FragmentState* value) { - return FragmentStatus_FragmentState_Parse(name, value); - } - // accessors ------------------------------------------------------- - // optional int64 memory_use = 1; - inline bool has_memory_use() const; - inline void clear_memory_use(); - static const int kMemoryUseFieldNumber = 1; - inline ::google::protobuf::int64 memory_use() const; - inline void set_memory_use(::google::protobuf::int64 value); - - // optional int64 batches_completed = 2; - inline bool has_batches_completed() const; - inline void clear_batches_completed(); - static const int kBatchesCompletedFieldNumber = 2; - inline ::google::protobuf::int64 batches_completed() const; - inline void set_batches_completed(::google::protobuf::int64 value); - - // optional int64 records_completed = 3; - inline bool has_records_completed() const; - inline void clear_records_completed(); - static const int kRecordsCompletedFieldNumber = 3; - inline ::google::protobuf::int64 records_completed() const; - inline void set_records_completed(::google::protobuf::int64 value); - - // optional int32 estimated_completion_percentage = 4; - inline bool has_estimated_completion_percentage() const; - inline void clear_estimated_completion_percentage(); - static const int kEstimatedCompletionPercentageFieldNumber = 4; - inline ::google::protobuf::int32 estimated_completion_percentage() const; - inline void set_estimated_completion_percentage(::google::protobuf::int32 value); - - // optional .exec.bit.control.FragmentStatus.FragmentState state = 5; - inline bool has_state() const; - inline void clear_state(); - static const int kStateFieldNumber = 5; - inline ::exec::bit::control::FragmentStatus_FragmentState state() const; - inline void set_state(::exec::bit::control::FragmentStatus_FragmentState value); - - // optional int64 data_processed = 6; - inline bool has_data_processed() const; - inline void clear_data_processed(); - static const int kDataProcessedFieldNumber = 6; - inline ::google::protobuf::int64 data_processed() const; - inline void set_data_processed(::google::protobuf::int64 value); - - // optional .exec.bit.FragmentHandle handle = 7; + // optional .exec.shared.MinorFragmentProfile profile = 1; + inline bool has_profile() const; + inline void clear_profile(); + static const int kProfileFieldNumber = 1; + inline const ::exec::shared::MinorFragmentProfile& profile() const; + inline ::exec::shared::MinorFragmentProfile* mutable_profile(); + inline ::exec::shared::MinorFragmentProfile* release_profile(); + inline void set_allocated_profile(::exec::shared::MinorFragmentProfile* profile); + + // optional .exec.bit.FragmentHandle handle = 2; inline bool has_handle() const; inline void clear_handle(); - static const int kHandleFieldNumber = 7; + static const int kHandleFieldNumber = 2; inline const ::exec::bit::FragmentHandle& handle() const; inline ::exec::bit::FragmentHandle* mutable_handle(); inline ::exec::bit::FragmentHandle* release_handle(); inline void set_allocated_handle(::exec::bit::FragmentHandle* handle); - // optional .exec.shared.DrillPBError error = 8; - inline bool has_error() const; - inline void clear_error(); - static const int kErrorFieldNumber = 8; - inline const ::exec::shared::DrillPBError& error() const; - inline ::exec::shared::DrillPBError* mutable_error(); - inline ::exec::shared::DrillPBError* release_error(); - inline void set_allocated_error(::exec::shared::DrillPBError* error); - - // optional int64 running_time = 9; - inline bool has_running_time() const; - inline void clear_running_time(); - static const int kRunningTimeFieldNumber = 9; - inline ::google::protobuf::int64 running_time() const; - inline void set_running_time(::google::protobuf::int64 value); - // @@protoc_insertion_point(class_scope:exec.bit.control.FragmentStatus) private: - inline void set_has_memory_use(); - inline void clear_has_memory_use(); - inline void set_has_batches_completed(); - inline void clear_has_batches_completed(); - inline void set_has_records_completed(); - inline void clear_has_records_completed(); - inline void set_has_estimated_completion_percentage(); - inline void clear_has_estimated_completion_percentage(); - inline void set_has_state(); - inline void clear_has_state(); - inline void set_has_data_processed(); - inline void clear_has_data_processed(); + inline void set_has_profile(); + inline void clear_has_profile(); inline void set_has_handle(); inline void clear_has_handle(); - inline void set_has_error(); - inline void clear_has_error(); - inline void set_has_running_time(); - inline void clear_has_running_time(); ::google::protobuf::UnknownFieldSet _unknown_fields_; - ::google::protobuf::int64 memory_use_; - ::google::protobuf::int64 batches_completed_; - ::google::protobuf::int64 records_completed_; - ::google::protobuf::int32 estimated_completion_percentage_; - int state_; - ::google::protobuf::int64 data_processed_; + ::exec::shared::MinorFragmentProfile* profile_; ::exec::bit::FragmentHandle* handle_; - ::exec::shared::DrillPBError* error_; - ::google::protobuf::int64 running_time_; mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(9 + 31) / 32]; + ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; friend void protobuf_AddDesc_BitControl_2eproto(); friend void protobuf_AssignDesc_BitControl_2eproto(); @@ -945,148 +824,53 @@ BitStatus::mutable_fragment_status() { // FragmentStatus -// optional int64 memory_use = 1; -inline bool FragmentStatus::has_memory_use() const { +// optional .exec.shared.MinorFragmentProfile profile = 1; +inline bool FragmentStatus::has_profile() const { return (_has_bits_[0] & 0x00000001u) != 0; } -inline void FragmentStatus::set_has_memory_use() { +inline void FragmentStatus::set_has_profile() { _has_bits_[0] |= 0x00000001u; } -inline void FragmentStatus::clear_has_memory_use() { +inline void FragmentStatus::clear_has_profile() { _has_bits_[0] &= ~0x00000001u; } -inline void FragmentStatus::clear_memory_use() { - memory_use_ = GOOGLE_LONGLONG(0); - clear_has_memory_use(); -} -inline ::google::protobuf::int64 FragmentStatus::memory_use() const { - return memory_use_; -} -inline void FragmentStatus::set_memory_use(::google::protobuf::int64 value) { - set_has_memory_use(); - memory_use_ = value; -} - -// optional int64 batches_completed = 2; -inline bool FragmentStatus::has_batches_completed() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -inline void FragmentStatus::set_has_batches_completed() { - _has_bits_[0] |= 0x00000002u; -} -inline void FragmentStatus::clear_has_batches_completed() { - _has_bits_[0] &= ~0x00000002u; -} -inline void FragmentStatus::clear_batches_completed() { - batches_completed_ = GOOGLE_LONGLONG(0); - clear_has_batches_completed(); -} -inline ::google::protobuf::int64 FragmentStatus::batches_completed() const { - return batches_completed_; -} -inline void FragmentStatus::set_batches_completed(::google::protobuf::int64 value) { - set_has_batches_completed(); - batches_completed_ = value; -} - -// optional int64 records_completed = 3; -inline bool FragmentStatus::has_records_completed() const { - return (_has_bits_[0] & 0x00000004u) != 0; -} -inline void FragmentStatus::set_has_records_completed() { - _has_bits_[0] |= 0x00000004u; -} -inline void FragmentStatus::clear_has_records_completed() { - _has_bits_[0] &= ~0x00000004u; -} -inline void FragmentStatus::clear_records_completed() { - records_completed_ = GOOGLE_LONGLONG(0); - clear_has_records_completed(); -} -inline ::google::protobuf::int64 FragmentStatus::records_completed() const { - return records_completed_; -} -inline void FragmentStatus::set_records_completed(::google::protobuf::int64 value) { - set_has_records_completed(); - records_completed_ = value; -} - -// optional int32 estimated_completion_percentage = 4; -inline bool FragmentStatus::has_estimated_completion_percentage() const { - return (_has_bits_[0] & 0x00000008u) != 0; -} -inline void FragmentStatus::set_has_estimated_completion_percentage() { - _has_bits_[0] |= 0x00000008u; -} -inline void FragmentStatus::clear_has_estimated_completion_percentage() { - _has_bits_[0] &= ~0x00000008u; -} -inline void FragmentStatus::clear_estimated_completion_percentage() { - estimated_completion_percentage_ = 0; - clear_has_estimated_completion_percentage(); -} -inline ::google::protobuf::int32 FragmentStatus::estimated_completion_percentage() const { - return estimated_completion_percentage_; -} -inline void FragmentStatus::set_estimated_completion_percentage(::google::protobuf::int32 value) { - set_has_estimated_completion_percentage(); - estimated_completion_percentage_ = value; -} - -// optional .exec.bit.control.FragmentStatus.FragmentState state = 5; -inline bool FragmentStatus::has_state() const { - return (_has_bits_[0] & 0x00000010u) != 0; -} -inline void FragmentStatus::set_has_state() { - _has_bits_[0] |= 0x00000010u; -} -inline void FragmentStatus::clear_has_state() { - _has_bits_[0] &= ~0x00000010u; -} -inline void FragmentStatus::clear_state() { - state_ = 0; - clear_has_state(); -} -inline ::exec::bit::control::FragmentStatus_FragmentState FragmentStatus::state() const { - return static_cast< ::exec::bit::control::FragmentStatus_FragmentState >(state_); -} -inline void FragmentStatus::set_state(::exec::bit::control::FragmentStatus_FragmentState value) { - assert(::exec::bit::control::FragmentStatus_FragmentState_IsValid(value)); - set_has_state(); - state_ = value; +inline void FragmentStatus::clear_profile() { + if (profile_ != NULL) profile_->::exec::shared::MinorFragmentProfile::Clear(); + clear_has_profile(); } - -// optional int64 data_processed = 6; -inline bool FragmentStatus::has_data_processed() const { - return (_has_bits_[0] & 0x00000020u) != 0; -} -inline void FragmentStatus::set_has_data_processed() { - _has_bits_[0] |= 0x00000020u; -} -inline void FragmentStatus::clear_has_data_processed() { - _has_bits_[0] &= ~0x00000020u; +inline const ::exec::shared::MinorFragmentProfile& FragmentStatus::profile() const { + return profile_ != NULL ? *profile_ : *default_instance_->profile_; } -inline void FragmentStatus::clear_data_processed() { - data_processed_ = GOOGLE_LONGLONG(0); - clear_has_data_processed(); +inline ::exec::shared::MinorFragmentProfile* FragmentStatus::mutable_profile() { + set_has_profile(); + if (profile_ == NULL) profile_ = new ::exec::shared::MinorFragmentProfile; + return profile_; } -inline ::google::protobuf::int64 FragmentStatus::data_processed() const { - return data_processed_; +inline ::exec::shared::MinorFragmentProfile* FragmentStatus::release_profile() { + clear_has_profile(); + ::exec::shared::MinorFragmentProfile* temp = profile_; + profile_ = NULL; + return temp; } -inline void FragmentStatus::set_data_processed(::google::protobuf::int64 value) { - set_has_data_processed(); - data_processed_ = value; +inline void FragmentStatus::set_allocated_profile(::exec::shared::MinorFragmentProfile* profile) { + delete profile_; + profile_ = profile; + if (profile) { + set_has_profile(); + } else { + clear_has_profile(); + } } -// optional .exec.bit.FragmentHandle handle = 7; +// optional .exec.bit.FragmentHandle handle = 2; inline bool FragmentStatus::has_handle() const { - return (_has_bits_[0] & 0x00000040u) != 0; + return (_has_bits_[0] & 0x00000002u) != 0; } inline void FragmentStatus::set_has_handle() { - _has_bits_[0] |= 0x00000040u; + _has_bits_[0] |= 0x00000002u; } inline void FragmentStatus::clear_has_handle() { - _has_bits_[0] &= ~0x00000040u; + _has_bits_[0] &= ~0x00000002u; } inline void FragmentStatus::clear_handle() { if (handle_ != NULL) handle_->::exec::bit::FragmentHandle::Clear(); @@ -1116,66 +900,6 @@ inline void FragmentStatus::set_allocated_handle(::exec::bit::FragmentHandle* ha } } -// optional .exec.shared.DrillPBError error = 8; -inline bool FragmentStatus::has_error() const { - return (_has_bits_[0] & 0x00000080u) != 0; -} -inline void FragmentStatus::set_has_error() { - _has_bits_[0] |= 0x00000080u; -} -inline void FragmentStatus::clear_has_error() { - _has_bits_[0] &= ~0x00000080u; -} -inline void FragmentStatus::clear_error() { - if (error_ != NULL) error_->::exec::shared::DrillPBError::Clear(); - clear_has_error(); -} -inline const ::exec::shared::DrillPBError& FragmentStatus::error() const { - return error_ != NULL ? *error_ : *default_instance_->error_; -} -inline ::exec::shared::DrillPBError* FragmentStatus::mutable_error() { - set_has_error(); - if (error_ == NULL) error_ = new ::exec::shared::DrillPBError; - return error_; -} -inline ::exec::shared::DrillPBError* FragmentStatus::release_error() { - clear_has_error(); - ::exec::shared::DrillPBError* temp = error_; - error_ = NULL; - return temp; -} -inline void FragmentStatus::set_allocated_error(::exec::shared::DrillPBError* error) { - delete error_; - error_ = error; - if (error) { - set_has_error(); - } else { - clear_has_error(); - } -} - -// optional int64 running_time = 9; -inline bool FragmentStatus::has_running_time() const { - return (_has_bits_[0] & 0x00000100u) != 0; -} -inline void FragmentStatus::set_has_running_time() { - _has_bits_[0] |= 0x00000100u; -} -inline void FragmentStatus::clear_has_running_time() { - _has_bits_[0] &= ~0x00000100u; -} -inline void FragmentStatus::clear_running_time() { - running_time_ = GOOGLE_LONGLONG(0); - clear_has_running_time(); -} -inline ::google::protobuf::int64 FragmentStatus::running_time() const { - return running_time_; -} -inline void FragmentStatus::set_running_time(::google::protobuf::int64 value) { - set_has_running_time(); - running_time_ = value; -} - // ------------------------------------------------------------------- // PlanFragment @@ -1768,10 +1492,6 @@ namespace google { namespace protobuf { template <> -inline const EnumDescriptor* GetEnumDescriptor< ::exec::bit::control::FragmentStatus_FragmentState>() { - return ::exec::bit::control::FragmentStatus_FragmentState_descriptor(); -} -template <> inline const EnumDescriptor* GetEnumDescriptor< ::exec::bit::control::RpcType>() { return ::exec::bit::control::RpcType_descriptor(); } diff --git a/contrib/native/client/src/protobuf/CMakeLists.txt b/contrib/native/client/src/protobuf/CMakeLists.txt index 98fbfbac2..154138d02 100644 --- a/contrib/native/client/src/protobuf/CMakeLists.txt +++ b/contrib/native/client/src/protobuf/CMakeLists.txt @@ -22,48 +22,48 @@ include_directories(${PROTOBUF_INCLUDE_DIR}) #Generate Protobuf code -set (PROTO_SRC_FILES - ${CMAKE_BINARY_DIR}/protobuf/BitControl.proto - ${CMAKE_BINARY_DIR}/protobuf/Coordination.proto - ${CMAKE_BINARY_DIR}/protobuf/GeneralRPC.proto - ${CMAKE_BINARY_DIR}/protobuf/Types.proto - ${CMAKE_BINARY_DIR}/protobuf/UserBitShared.proto - ${CMAKE_BINARY_DIR}/protobuf/BitData.proto - ${CMAKE_BINARY_DIR}/protobuf/ExecutionProtos.proto - ${CMAKE_BINARY_DIR}/protobuf/SchemaDef.proto +set (PROTO_SRC_FILES + ${CMAKE_BINARY_DIR}/protobuf/BitControl.proto + ${CMAKE_BINARY_DIR}/protobuf/Coordination.proto + ${CMAKE_BINARY_DIR}/protobuf/GeneralRPC.proto + ${CMAKE_BINARY_DIR}/protobuf/Types.proto + ${CMAKE_BINARY_DIR}/protobuf/UserBitShared.proto + ${CMAKE_BINARY_DIR}/protobuf/BitData.proto + ${CMAKE_BINARY_DIR}/protobuf/ExecutionProtos.proto + ${CMAKE_BINARY_DIR}/protobuf/SchemaDef.proto ${CMAKE_BINARY_DIR}/protobuf/User.proto ) PROTOBUF_GENERATE_CPP(GenProtoSources GenProtoHeaders ${PROTO_SRC_FILES}) -set (PROTO_CPPSRC_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/BitControl.pb.cc - ${CMAKE_CURRENT_SOURCE_DIR}/Coordination.pb.cc - ${CMAKE_CURRENT_SOURCE_DIR}/GeneralRPC.pb.cc - ${CMAKE_CURRENT_SOURCE_DIR}/Types.pb.cc - ${CMAKE_CURRENT_SOURCE_DIR}/UserBitShared.pb.cc - ${CMAKE_CURRENT_SOURCE_DIR}/BitData.pb.cc - ${CMAKE_CURRENT_SOURCE_DIR}/ExecutionProtos.pb.cc - ${CMAKE_CURRENT_SOURCE_DIR}/SchemaDef.pb.cc +set (PROTO_CPPSRC_FILES + ${CMAKE_CURRENT_SOURCE_DIR}/BitControl.pb.cc + ${CMAKE_CURRENT_SOURCE_DIR}/Coordination.pb.cc + ${CMAKE_CURRENT_SOURCE_DIR}/GeneralRPC.pb.cc + ${CMAKE_CURRENT_SOURCE_DIR}/Types.pb.cc + ${CMAKE_CURRENT_SOURCE_DIR}/UserBitShared.pb.cc + ${CMAKE_CURRENT_SOURCE_DIR}/BitData.pb.cc + ${CMAKE_CURRENT_SOURCE_DIR}/ExecutionProtos.pb.cc + ${CMAKE_CURRENT_SOURCE_DIR}/SchemaDef.pb.cc ${CMAKE_CURRENT_SOURCE_DIR}/User.pb.cc ) set (PROTO_HDR_DIR ${CMAKE_CURRENT_SOURCE_DIR}) -set (PROTO_CPPHDR_FILES - ${PROTO_HDR_DIR}/BitControl.pb.h - ${PROTO_HDR_DIR}/Coordination.pb.h - ${PROTO_HDR_DIR}/GeneralRPC.pb.h - ${PROTO_HDR_DIR}/UserBitShared.pb.h - ${PROTO_HDR_DIR}/BitData.pb.h - ${PROTO_HDR_DIR}/ExecutionProtos.pb.h - ${PROTO_HDR_DIR}/SchemaDef.pb.h +set (PROTO_CPPHDR_FILES + ${PROTO_HDR_DIR}/BitControl.pb.h + ${PROTO_HDR_DIR}/Coordination.pb.h + ${PROTO_HDR_DIR}/GeneralRPC.pb.h + ${PROTO_HDR_DIR}/UserBitShared.pb.h + ${PROTO_HDR_DIR}/BitData.pb.h + ${PROTO_HDR_DIR}/ExecutionProtos.pb.h + ${PROTO_HDR_DIR}/SchemaDef.pb.h ) set (PROTO_INC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../include/drill/protobuf) -set (PROTO_CPPINC_FILES - ${PROTO_INC_DIR}/Types.pb.h +set (PROTO_CPPINC_FILES + ${PROTO_INC_DIR}/Types.pb.h ${PROTO_INC_DIR}/User.pb.h ) diff --git a/contrib/native/client/src/protobuf/User.pb.cc b/contrib/native/client/src/protobuf/User.pb.cc index d2826ead8..a2bd4dfcc 100644 --- a/contrib/native/client/src/protobuf/User.pb.cc +++ b/contrib/native/client/src/protobuf/User.pb.cc @@ -47,7 +47,6 @@ const ::google::protobuf::internal::GeneratedMessageReflection* QueryResult_reflection_ = NULL; const ::google::protobuf::EnumDescriptor* QueryResult_QueryState_descriptor_ = NULL; const ::google::protobuf::EnumDescriptor* RpcType_descriptor_ = NULL; -const ::google::protobuf::EnumDescriptor* QueryType_descriptor_ = NULL; const ::google::protobuf::EnumDescriptor* QueryResultsMode_descriptor_ = NULL; } // namespace @@ -200,8 +199,7 @@ void protobuf_AssignDesc_User_2eproto() { sizeof(QueryResult)); QueryResult_QueryState_descriptor_ = QueryResult_descriptor_->enum_type(0); RpcType_descriptor_ = file->enum_type(0); - QueryType_descriptor_ = file->enum_type(1); - QueryResultsMode_descriptor_ = file->enum_type(2); + QueryResultsMode_descriptor_ = file->enum_type(1); } namespace { @@ -273,32 +271,31 @@ void protobuf_AddDesc_User_2eproto() { "redentials\022-\n\nproperties\030\005 \001(\0132\031.exec.us" "er.UserProperties\"S\n\016RequestResults\022&\n\010q" "uery_id\030\001 \001(\0132\024.exec.shared.QueryId\022\031\n\021m" - "aximum_responses\030\002 \001(\005\"o\n\010RunQuery\0221\n\014re" + "aximum_responses\030\002 \001(\005\"q\n\010RunQuery\0221\n\014re" "sults_mode\030\001 \001(\0162\033.exec.user.QueryResult" - "sMode\022\"\n\004type\030\002 \001(\0162\024.exec.user.QueryTyp" - "e\022\014\n\004plan\030\003 \001(\t\")\n\022BitToUserHandshake\022\023\n" - "\013rpc_version\030\002 \001(\005\"7\n\nNodeStatus\022\017\n\007node" - "_id\030\001 \001(\005\022\030\n\020memory_footprint\030\002 \001(\003\"\331\003\n\013" - "QueryResult\0226\n\013query_state\030\001 \001(\0162!.exec." - "user.QueryResult.QueryState\022&\n\010query_id\030" - "\002 \001(\0132\024.exec.shared.QueryId\022\025\n\ris_last_c" - "hunk\030\003 \001(\010\022\021\n\trow_count\030\004 \001(\005\022\024\n\014records" - "_scan\030\005 \001(\003\022\025\n\rrecords_error\030\006 \001(\003\022\027\n\017su" - "bmission_time\030\007 \001(\003\022*\n\013node_status\030\010 \003(\013" - "2\025.exec.user.NodeStatus\022(\n\005error\030\t \003(\0132\031" - ".exec.shared.DrillPBError\022(\n\003def\030\n \001(\0132\033" - ".exec.shared.RecordBatchDef\022\026\n\016schema_ch" - "anged\030\013 \001(\010\"b\n\nQueryState\022\013\n\007PENDING\020\000\022\013" - "\n\007RUNNING\020\001\022\r\n\tCOMPLETED\020\002\022\014\n\010CANCELED\020\003" - "\022\n\n\006FAILED\020\004\022\021\n\rUNKNOWN_QUERY\020\005*\270\001\n\007RpcT" - "ype\022\r\n\tHANDSHAKE\020\000\022\007\n\003ACK\020\001\022\013\n\007GOODBYE\020\002" - "\022\r\n\tRUN_QUERY\020\003\022\020\n\014CANCEL_QUERY\020\004\022\023\n\017REQ" - "UEST_RESULTS\020\005\022\020\n\014QUERY_RESULT\020\006\022\020\n\014QUER" - "Y_HANDLE\020\007\022\026\n\022REQ_META_FUNCTIONS\020\010\022\026\n\022RE" - "SP_FUNCTION_LIST\020\t*/\n\tQueryType\022\007\n\003SQL\020\001" - "\022\013\n\007LOGICAL\020\002\022\014\n\010PHYSICAL\020\003*#\n\020QueryResu" - "ltsMode\022\017\n\013STREAM_FULL\020\001B+\n\033org.apache.d" - "rill.exec.protoB\nUserProtosH\001", 1469); + "sMode\022$\n\004type\030\002 \001(\0162\026.exec.shared.QueryT" + "ype\022\014\n\004plan\030\003 \001(\t\")\n\022BitToUserHandshake\022" + "\023\n\013rpc_version\030\002 \001(\005\"7\n\nNodeStatus\022\017\n\007no" + "de_id\030\001 \001(\005\022\030\n\020memory_footprint\030\002 \001(\003\"\331\003" + "\n\013QueryResult\0226\n\013query_state\030\001 \001(\0162!.exe" + "c.user.QueryResult.QueryState\022&\n\010query_i" + "d\030\002 \001(\0132\024.exec.shared.QueryId\022\025\n\ris_last" + "_chunk\030\003 \001(\010\022\021\n\trow_count\030\004 \001(\005\022\024\n\014recor" + "ds_scan\030\005 \001(\003\022\025\n\rrecords_error\030\006 \001(\003\022\027\n\017" + "submission_time\030\007 \001(\003\022*\n\013node_status\030\010 \003" + "(\0132\025.exec.user.NodeStatus\022(\n\005error\030\t \003(\013" + "2\031.exec.shared.DrillPBError\022(\n\003def\030\n \001(\013" + "2\033.exec.shared.RecordBatchDef\022\026\n\016schema_" + "changed\030\013 \001(\010\"b\n\nQueryState\022\013\n\007PENDING\020\000" + "\022\013\n\007RUNNING\020\001\022\r\n\tCOMPLETED\020\002\022\014\n\010CANCELED" + "\020\003\022\n\n\006FAILED\020\004\022\021\n\rUNKNOWN_QUERY\020\005*\270\001\n\007Rp" + "cType\022\r\n\tHANDSHAKE\020\000\022\007\n\003ACK\020\001\022\013\n\007GOODBYE" + "\020\002\022\r\n\tRUN_QUERY\020\003\022\020\n\014CANCEL_QUERY\020\004\022\023\n\017R" + "EQUEST_RESULTS\020\005\022\020\n\014QUERY_RESULT\020\006\022\020\n\014QU" + "ERY_HANDLE\020\007\022\026\n\022REQ_META_FUNCTIONS\020\010\022\026\n\022" + "RESP_FUNCTION_LIST\020\t*#\n\020QueryResultsMode" + "\022\017\n\013STREAM_FULL\020\001B+\n\033org.apache.drill.ex" + "ec.protoB\nUserProtosH\001", 1422); ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "User.proto", &protobuf_RegisterTypes); Property::default_instance_ = new Property(); @@ -348,21 +345,6 @@ bool RpcType_IsValid(int value) { } } -const ::google::protobuf::EnumDescriptor* QueryType_descriptor() { - protobuf_AssignDescriptorsOnce(); - return QueryType_descriptor_; -} -bool QueryType_IsValid(int value) { - switch(value) { - case 1: - case 2: - case 3: - return true; - default: - return false; - } -} - const ::google::protobuf::EnumDescriptor* QueryResultsMode_descriptor() { protobuf_AssignDescriptorsOnce(); return QueryResultsMode_descriptor_; @@ -1607,7 +1589,7 @@ bool RunQuery::MergePartialFromCodedStream( break; } - // optional .exec.user.QueryType type = 2; + // optional .exec.shared.QueryType type = 2; case 2: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { @@ -1616,8 +1598,8 @@ bool RunQuery::MergePartialFromCodedStream( DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( input, &value))); - if (::exec::user::QueryType_IsValid(value)) { - set_type(static_cast< ::exec::user::QueryType >(value)); + if (::exec::shared::QueryType_IsValid(value)) { + set_type(static_cast< ::exec::shared::QueryType >(value)); } else { mutable_unknown_fields()->AddVarint(2, value); } @@ -1669,7 +1651,7 @@ void RunQuery::SerializeWithCachedSizes( 1, this->results_mode(), output); } - // optional .exec.user.QueryType type = 2; + // optional .exec.shared.QueryType type = 2; if (has_type()) { ::google::protobuf::internal::WireFormatLite::WriteEnum( 2, this->type(), output); @@ -1698,7 +1680,7 @@ void RunQuery::SerializeWithCachedSizes( 1, this->results_mode(), target); } - // optional .exec.user.QueryType type = 2; + // optional .exec.shared.QueryType type = 2; if (has_type()) { target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray( 2, this->type(), target); @@ -1731,7 +1713,7 @@ int RunQuery::ByteSize() const { ::google::protobuf::internal::WireFormatLite::EnumSize(this->results_mode()); } - // optional .exec.user.QueryType type = 2; + // optional .exec.shared.QueryType type = 2; if (has_type()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::EnumSize(this->type()); diff --git a/contrib/native/client/src/protobuf/UserBitShared.pb.cc b/contrib/native/client/src/protobuf/UserBitShared.pb.cc index 1a0b634a8..154de5471 100644 --- a/contrib/native/client/src/protobuf/UserBitShared.pb.cc +++ b/contrib/native/client/src/protobuf/UserBitShared.pb.cc @@ -43,7 +43,28 @@ const ::google::protobuf::EnumDescriptor* NamePart_Type_descriptor_ = NULL; const ::google::protobuf::Descriptor* SerializedField_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* SerializedField_reflection_ = NULL; +const ::google::protobuf::Descriptor* QueryProfile_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + QueryProfile_reflection_ = NULL; +const ::google::protobuf::Descriptor* MajorFragmentProfile_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + MajorFragmentProfile_reflection_ = NULL; +const ::google::protobuf::Descriptor* MinorFragmentProfile_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + MinorFragmentProfile_reflection_ = NULL; +const ::google::protobuf::Descriptor* OperatorProfile_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + OperatorProfile_reflection_ = NULL; +const ::google::protobuf::Descriptor* StreamProfile_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + StreamProfile_reflection_ = NULL; +const ::google::protobuf::Descriptor* MetricValue_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + MetricValue_reflection_ = NULL; const ::google::protobuf::EnumDescriptor* RpcChannel_descriptor_ = NULL; +const ::google::protobuf::EnumDescriptor* QueryType_descriptor_ = NULL; +const ::google::protobuf::EnumDescriptor* FragmentState_descriptor_ = NULL; +const ::google::protobuf::EnumDescriptor* CoreOperatorType_descriptor_ = NULL; } // namespace @@ -178,7 +199,125 @@ void protobuf_AssignDesc_UserBitShared_2eproto() { ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(SerializedField)); + QueryProfile_descriptor_ = file->message_type(7); + static const int QueryProfile_offsets_[7] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(QueryProfile, id_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(QueryProfile, type_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(QueryProfile, start_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(QueryProfile, end_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(QueryProfile, query_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(QueryProfile, plan_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(QueryProfile, fragment_profile_), + }; + QueryProfile_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + QueryProfile_descriptor_, + QueryProfile::default_instance_, + QueryProfile_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(QueryProfile, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(QueryProfile, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(QueryProfile)); + MajorFragmentProfile_descriptor_ = file->message_type(8); + static const int MajorFragmentProfile_offsets_[2] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MajorFragmentProfile, major_fragment_id_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MajorFragmentProfile, minor_fragment_profile_), + }; + MajorFragmentProfile_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + MajorFragmentProfile_descriptor_, + MajorFragmentProfile::default_instance_, + MajorFragmentProfile_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MajorFragmentProfile, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MajorFragmentProfile, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(MajorFragmentProfile)); + MinorFragmentProfile_descriptor_ = file->message_type(9); + static const int MinorFragmentProfile_offsets_[9] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MinorFragmentProfile, state_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MinorFragmentProfile, error_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MinorFragmentProfile, minor_fragment_id_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MinorFragmentProfile, operator_profile_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MinorFragmentProfile, start_time_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MinorFragmentProfile, end_time_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MinorFragmentProfile, memory_used_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MinorFragmentProfile, max_memory_used_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MinorFragmentProfile, endpoint_), + }; + MinorFragmentProfile_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + MinorFragmentProfile_descriptor_, + MinorFragmentProfile::default_instance_, + MinorFragmentProfile_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MinorFragmentProfile, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MinorFragmentProfile, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(MinorFragmentProfile)); + OperatorProfile_descriptor_ = file->message_type(10); + static const int OperatorProfile_offsets_[7] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OperatorProfile, input_profile_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OperatorProfile, operator_id_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OperatorProfile, operator_type_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OperatorProfile, setup_nanos_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OperatorProfile, process_nanos_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OperatorProfile, local_memory_allocated_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OperatorProfile, metric_), + }; + OperatorProfile_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + OperatorProfile_descriptor_, + OperatorProfile::default_instance_, + OperatorProfile_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OperatorProfile, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OperatorProfile, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(OperatorProfile)); + StreamProfile_descriptor_ = file->message_type(11); + static const int StreamProfile_offsets_[3] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StreamProfile, records_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StreamProfile, batches_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StreamProfile, schemas_), + }; + StreamProfile_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + StreamProfile_descriptor_, + StreamProfile::default_instance_, + StreamProfile_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StreamProfile, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StreamProfile, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(StreamProfile)); + MetricValue_descriptor_ = file->message_type(12); + static const int MetricValue_offsets_[3] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetricValue, metric_id_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetricValue, long_value_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetricValue, double_value_), + }; + MetricValue_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + MetricValue_descriptor_, + MetricValue::default_instance_, + MetricValue_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetricValue, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetricValue, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(MetricValue)); RpcChannel_descriptor_ = file->enum_type(0); + QueryType_descriptor_ = file->enum_type(1); + FragmentState_descriptor_ = file->enum_type(2); + CoreOperatorType_descriptor_ = file->enum_type(3); } namespace { @@ -205,6 +344,18 @@ void protobuf_RegisterTypes(const ::std::string&) { NamePart_descriptor_, &NamePart::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( SerializedField_descriptor_, &SerializedField::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + QueryProfile_descriptor_, &QueryProfile::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + MajorFragmentProfile_descriptor_, &MajorFragmentProfile::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + MinorFragmentProfile_descriptor_, &MinorFragmentProfile::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + OperatorProfile_descriptor_, &OperatorProfile::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + StreamProfile_descriptor_, &StreamProfile::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + MetricValue_descriptor_, &MetricValue::default_instance()); } } // namespace @@ -224,6 +375,18 @@ void protobuf_ShutdownFile_UserBitShared_2eproto() { delete NamePart_reflection_; delete SerializedField::default_instance_; delete SerializedField_reflection_; + delete QueryProfile::default_instance_; + delete QueryProfile_reflection_; + delete MajorFragmentProfile::default_instance_; + delete MajorFragmentProfile_reflection_; + delete MinorFragmentProfile::default_instance_; + delete MinorFragmentProfile_reflection_; + delete OperatorProfile::default_instance_; + delete OperatorProfile_reflection_; + delete StreamProfile::default_instance_; + delete StreamProfile_reflection_; + delete MetricValue::default_instance_; + delete MetricValue_reflection_; } void protobuf_AddDesc_UserBitShared_2eproto() { @@ -258,10 +421,55 @@ void protobuf_AddDesc_UserBitShared_2eproto() { "hared.NamePart\022+\n\005child\030\003 \003(\0132\034.exec.sha" "red.SerializedField\022\023\n\013value_count\030\004 \001(\005" "\022\027\n\017var_byte_length\030\005 \001(\005\022\023\n\013group_count" - "\030\006 \001(\005\022\025\n\rbuffer_length\030\007 \001(\005*5\n\nRpcChan" - "nel\022\017\n\013BIT_CONTROL\020\000\022\014\n\010BIT_DATA\020\001\022\010\n\004US" - "ER\020\002B.\n\033org.apache.drill.exec.protoB\rUse" - "rBitSharedH\001", 1012); + "\030\006 \001(\005\022\025\n\rbuffer_length\030\007 \001(\005\"\314\001\n\014QueryP" + "rofile\022 \n\002id\030\001 \001(\0132\024.exec.shared.QueryId" + "\022$\n\004type\030\002 \001(\0162\026.exec.shared.QueryType\022\r" + "\n\005start\030\003 \001(\003\022\013\n\003end\030\004 \001(\003\022\r\n\005query\030\005 \001(" + "\t\022\014\n\004plan\030\006 \001(\t\022;\n\020fragment_profile\030\007 \003(" + "\0132!.exec.shared.MajorFragmentProfile\"t\n\024" + "MajorFragmentProfile\022\031\n\021major_fragment_i" + "d\030\001 \001(\005\022A\n\026minor_fragment_profile\030\002 \003(\0132" + "!.exec.shared.MinorFragmentProfile\"\274\002\n\024M" + "inorFragmentProfile\022)\n\005state\030\001 \001(\0162\032.exe" + "c.shared.FragmentState\022(\n\005error\030\002 \001(\0132\031." + "exec.shared.DrillPBError\022\031\n\021minor_fragme" + "nt_id\030\003 \001(\005\0226\n\020operator_profile\030\004 \003(\0132\034." + "exec.shared.OperatorProfile\022\022\n\nstart_tim" + "e\030\005 \001(\003\022\020\n\010end_time\030\006 \001(\003\022\023\n\013memory_used" + "\030\007 \001(\003\022\027\n\017max_memory_used\030\010 \001(\003\022(\n\010endpo" + "int\030\t \001(\0132\026.exec.DrillbitEndpoint\"\346\001\n\017Op" + "eratorProfile\0221\n\rinput_profile\030\001 \003(\0132\032.e" + "xec.shared.StreamProfile\022\023\n\013operator_id\030" + "\003 \001(\005\022\025\n\roperator_type\030\004 \001(\005\022\023\n\013setup_na" + "nos\030\005 \001(\003\022\025\n\rprocess_nanos\030\006 \001(\003\022\036\n\026loca" + "l_memory_allocated\030\007 \001(\003\022(\n\006metric\030\010 \003(\013" + "2\030.exec.shared.MetricValue\"B\n\rStreamProf" + "ile\022\017\n\007records\030\001 \001(\003\022\017\n\007batches\030\002 \001(\003\022\017\n" + "\007schemas\030\003 \001(\003\"J\n\013MetricValue\022\021\n\tmetric_" + "id\030\001 \001(\005\022\022\n\nlong_value\030\002 \001(\003\022\024\n\014double_v" + "alue\030\003 \001(\001*5\n\nRpcChannel\022\017\n\013BIT_CONTROL\020" + "\000\022\014\n\010BIT_DATA\020\001\022\010\n\004USER\020\002*/\n\tQueryType\022\007" + "\n\003SQL\020\001\022\013\n\007LOGICAL\020\002\022\014\n\010PHYSICAL\020\003*k\n\rFr" + "agmentState\022\013\n\007SENDING\020\000\022\027\n\023AWAITING_ALL" + "OCATION\020\001\022\013\n\007RUNNING\020\002\022\014\n\010FINISHED\020\003\022\r\n\t" + "CANCELLED\020\004\022\n\n\006FAILED\020\005*\345\004\n\020CoreOperator" + "Type\022\021\n\rSINGLE_SENDER\020\000\022\024\n\020BROADCAST_SEN" + "DER\020\001\022\n\n\006FILTER\020\002\022\022\n\016HASH_AGGREGATE\020\003\022\r\n" + "\tHASH_JOIN\020\004\022\016\n\nMERGE_JOIN\020\005\022\031\n\025HASH_PAR" + "TITION_SENDER\020\006\022\t\n\005LIMIT\020\007\022\024\n\020MERGING_RE" + "CEIVER\020\010\022\034\n\030ORDERED_PARTITION_SENDER\020\t\022\013" + "\n\007PROJECT\020\n\022\023\n\017RANDOM_RECEIVER\020\013\022\020\n\014RANG" + "E_SENDER\020\014\022\n\n\006SCREEN\020\r\022\034\n\030SELECTION_VECT" + "OR_REMOVER\020\016\022\027\n\023STREAMING_AGGREGATE\020\017\022\016\n" + "\nTOP_N_SORT\020\020\022\021\n\rEXTERNAL_SORT\020\021\022\t\n\005TRAC" + "E\020\022\022\t\n\005UNION\020\023\022\014\n\010OLD_SORT\020\024\022\032\n\026PARQUET_" + "ROW_GROUP_SCAN\020\025\022\021\n\rHIVE_SUB_SCAN\020\026\022\025\n\021S" + "YSTEM_TABLE_SCAN\020\027\022\021\n\rMOCK_SUB_SCAN\020\030\022\022\n" + "\016PARQUET_WRITER\020\031\022\023\n\017DIRECT_SUB_SCAN\020\032\022\017" + "\n\013TEXT_WRITER\020\033\022\021\n\rTEXT_SUB_SCAN\020\034\022\021\n\rJS" + "ON_SUB_SCAN\020\035\022\030\n\024INFO_SCHEMA_SUB_SCAN\020\036B" + ".\n\033org.apache.drill.exec.protoB\rUserBitS" + "haredH\001", 2807); ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "UserBitShared.proto", &protobuf_RegisterTypes); UserCredentials::default_instance_ = new UserCredentials(); @@ -271,6 +479,12 @@ void protobuf_AddDesc_UserBitShared_2eproto() { RecordBatchDef::default_instance_ = new RecordBatchDef(); NamePart::default_instance_ = new NamePart(); SerializedField::default_instance_ = new SerializedField(); + QueryProfile::default_instance_ = new QueryProfile(); + MajorFragmentProfile::default_instance_ = new MajorFragmentProfile(); + MinorFragmentProfile::default_instance_ = new MinorFragmentProfile(); + OperatorProfile::default_instance_ = new OperatorProfile(); + StreamProfile::default_instance_ = new StreamProfile(); + MetricValue::default_instance_ = new MetricValue(); UserCredentials::default_instance_->InitAsDefaultInstance(); QueryId::default_instance_->InitAsDefaultInstance(); DrillPBError::default_instance_->InitAsDefaultInstance(); @@ -278,6 +492,12 @@ void protobuf_AddDesc_UserBitShared_2eproto() { RecordBatchDef::default_instance_->InitAsDefaultInstance(); NamePart::default_instance_->InitAsDefaultInstance(); SerializedField::default_instance_->InitAsDefaultInstance(); + QueryProfile::default_instance_->InitAsDefaultInstance(); + MajorFragmentProfile::default_instance_->InitAsDefaultInstance(); + MinorFragmentProfile::default_instance_->InitAsDefaultInstance(); + OperatorProfile::default_instance_->InitAsDefaultInstance(); + StreamProfile::default_instance_->InitAsDefaultInstance(); + MetricValue::default_instance_->InitAsDefaultInstance(); ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_UserBitShared_2eproto); } @@ -302,6 +522,82 @@ bool RpcChannel_IsValid(int value) { } } +const ::google::protobuf::EnumDescriptor* QueryType_descriptor() { + protobuf_AssignDescriptorsOnce(); + return QueryType_descriptor_; +} +bool QueryType_IsValid(int value) { + switch(value) { + case 1: + case 2: + case 3: + return true; + default: + return false; + } +} + +const ::google::protobuf::EnumDescriptor* FragmentState_descriptor() { + protobuf_AssignDescriptorsOnce(); + return FragmentState_descriptor_; +} +bool FragmentState_IsValid(int value) { + switch(value) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + return true; + default: + return false; + } +} + +const ::google::protobuf::EnumDescriptor* CoreOperatorType_descriptor() { + protobuf_AssignDescriptorsOnce(); + return CoreOperatorType_descriptor_; +} +bool CoreOperatorType_IsValid(int value) { + switch(value) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + case 22: + case 23: + case 24: + case 25: + case 26: + case 27: + case 28: + case 29: + case 30: + return true; + default: + return false; + } +} + // =================================================================== @@ -2588,6 +2884,2320 @@ void SerializedField::Swap(SerializedField* other) { } +// =================================================================== + +#ifndef _MSC_VER +const int QueryProfile::kIdFieldNumber; +const int QueryProfile::kTypeFieldNumber; +const int QueryProfile::kStartFieldNumber; +const int QueryProfile::kEndFieldNumber; +const int QueryProfile::kQueryFieldNumber; +const int QueryProfile::kPlanFieldNumber; +const int QueryProfile::kFragmentProfileFieldNumber; +#endif // !_MSC_VER + +QueryProfile::QueryProfile() + : ::google::protobuf::Message() { + SharedCtor(); +} + +void QueryProfile::InitAsDefaultInstance() { + id_ = const_cast< ::exec::shared::QueryId*>(&::exec::shared::QueryId::default_instance()); +} + +QueryProfile::QueryProfile(const QueryProfile& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); +} + +void QueryProfile::SharedCtor() { + _cached_size_ = 0; + id_ = NULL; + type_ = 1; + start_ = GOOGLE_LONGLONG(0); + end_ = GOOGLE_LONGLONG(0); + query_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + plan_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +QueryProfile::~QueryProfile() { + SharedDtor(); +} + +void QueryProfile::SharedDtor() { + if (query_ != &::google::protobuf::internal::kEmptyString) { + delete query_; + } + if (plan_ != &::google::protobuf::internal::kEmptyString) { + delete plan_; + } + if (this != default_instance_) { + delete id_; + } +} + +void QueryProfile::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* QueryProfile::descriptor() { + protobuf_AssignDescriptorsOnce(); + return QueryProfile_descriptor_; +} + +const QueryProfile& QueryProfile::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_UserBitShared_2eproto(); + return *default_instance_; +} + +QueryProfile* QueryProfile::default_instance_ = NULL; + +QueryProfile* QueryProfile::New() const { + return new QueryProfile; +} + +void QueryProfile::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (has_id()) { + if (id_ != NULL) id_->::exec::shared::QueryId::Clear(); + } + type_ = 1; + start_ = GOOGLE_LONGLONG(0); + end_ = GOOGLE_LONGLONG(0); + if (has_query()) { + if (query_ != &::google::protobuf::internal::kEmptyString) { + query_->clear(); + } + } + if (has_plan()) { + if (plan_ != &::google::protobuf::internal::kEmptyString) { + plan_->clear(); + } + } + } + fragment_profile_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool QueryProfile::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional .exec.shared.QueryId id = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_id())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(16)) goto parse_type; + break; + } + + // optional .exec.shared.QueryType type = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_type: + int value; + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( + input, &value))); + if (::exec::shared::QueryType_IsValid(value)) { + set_type(static_cast< ::exec::shared::QueryType >(value)); + } else { + mutable_unknown_fields()->AddVarint(2, value); + } + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(24)) goto parse_start; + break; + } + + // optional int64 start = 3; + case 3: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_start: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( + input, &start_))); + set_has_start(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(32)) goto parse_end; + break; + } + + // optional int64 end = 4; + case 4: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_end: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( + input, &end_))); + set_has_end(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(42)) goto parse_query; + break; + } + + // optional string query = 5; + case 5: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_query: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_query())); + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->query().data(), this->query().length(), + ::google::protobuf::internal::WireFormat::PARSE); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(50)) goto parse_plan; + break; + } + + // optional string plan = 6; + case 6: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_plan: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_plan())); + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->plan().data(), this->plan().length(), + ::google::protobuf::internal::WireFormat::PARSE); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(58)) goto parse_fragment_profile; + break; + } + + // repeated .exec.shared.MajorFragmentProfile fragment_profile = 7; + case 7: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_fragment_profile: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_fragment_profile())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(58)) goto parse_fragment_profile; + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } + return true; +#undef DO_ +} + +void QueryProfile::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // optional .exec.shared.QueryId id = 1; + if (has_id()) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 1, this->id(), output); + } + + // optional .exec.shared.QueryType type = 2; + if (has_type()) { + ::google::protobuf::internal::WireFormatLite::WriteEnum( + 2, this->type(), output); + } + + // optional int64 start = 3; + if (has_start()) { + ::google::protobuf::internal::WireFormatLite::WriteInt64(3, this->start(), output); + } + + // optional int64 end = 4; + if (has_end()) { + ::google::protobuf::internal::WireFormatLite::WriteInt64(4, this->end(), output); + } + + // optional string query = 5; + if (has_query()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->query().data(), this->query().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + ::google::protobuf::internal::WireFormatLite::WriteString( + 5, this->query(), output); + } + + // optional string plan = 6; + if (has_plan()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->plan().data(), this->plan().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + ::google::protobuf::internal::WireFormatLite::WriteString( + 6, this->plan(), output); + } + + // repeated .exec.shared.MajorFragmentProfile fragment_profile = 7; + for (int i = 0; i < this->fragment_profile_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 7, this->fragment_profile(i), output); + } + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } +} + +::google::protobuf::uint8* QueryProfile::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // optional .exec.shared.QueryId id = 1; + if (has_id()) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 1, this->id(), target); + } + + // optional .exec.shared.QueryType type = 2; + if (has_type()) { + target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray( + 2, this->type(), target); + } + + // optional int64 start = 3; + if (has_start()) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(3, this->start(), target); + } + + // optional int64 end = 4; + if (has_end()) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(4, this->end(), target); + } + + // optional string query = 5; + if (has_query()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->query().data(), this->query().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 5, this->query(), target); + } + + // optional string plan = 6; + if (has_plan()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->plan().data(), this->plan().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 6, this->plan(), target); + } + + // repeated .exec.shared.MajorFragmentProfile fragment_profile = 7; + for (int i = 0; i < this->fragment_profile_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 7, this->fragment_profile(i), target); + } + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + return target; +} + +int QueryProfile::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // optional .exec.shared.QueryId id = 1; + if (has_id()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->id()); + } + + // optional .exec.shared.QueryType type = 2; + if (has_type()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::EnumSize(this->type()); + } + + // optional int64 start = 3; + if (has_start()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int64Size( + this->start()); + } + + // optional int64 end = 4; + if (has_end()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int64Size( + this->end()); + } + + // optional string query = 5; + if (has_query()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->query()); + } + + // optional string plan = 6; + if (has_plan()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->plan()); + } + + } + // repeated .exec.shared.MajorFragmentProfile fragment_profile = 7; + total_size += 1 * this->fragment_profile_size(); + for (int i = 0; i < this->fragment_profile_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->fragment_profile(i)); + } + + if (!unknown_fields().empty()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void QueryProfile::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const QueryProfile* source = + ::google::protobuf::internal::dynamic_cast_if_available<const QueryProfile*>( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void QueryProfile::MergeFrom(const QueryProfile& from) { + GOOGLE_CHECK_NE(&from, this); + fragment_profile_.MergeFrom(from.fragment_profile_); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_id()) { + mutable_id()->::exec::shared::QueryId::MergeFrom(from.id()); + } + if (from.has_type()) { + set_type(from.type()); + } + if (from.has_start()) { + set_start(from.start()); + } + if (from.has_end()) { + set_end(from.end()); + } + if (from.has_query()) { + set_query(from.query()); + } + if (from.has_plan()) { + set_plan(from.plan()); + } + } + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void QueryProfile::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void QueryProfile::CopyFrom(const QueryProfile& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool QueryProfile::IsInitialized() const { + + return true; +} + +void QueryProfile::Swap(QueryProfile* other) { + if (other != this) { + std::swap(id_, other->id_); + std::swap(type_, other->type_); + std::swap(start_, other->start_); + std::swap(end_, other->end_); + std::swap(query_, other->query_); + std::swap(plan_, other->plan_); + fragment_profile_.Swap(&other->fragment_profile_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _unknown_fields_.Swap(&other->_unknown_fields_); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::google::protobuf::Metadata QueryProfile::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = QueryProfile_descriptor_; + metadata.reflection = QueryProfile_reflection_; + return metadata; +} + + +// =================================================================== + +#ifndef _MSC_VER +const int MajorFragmentProfile::kMajorFragmentIdFieldNumber; +const int MajorFragmentProfile::kMinorFragmentProfileFieldNumber; +#endif // !_MSC_VER + +MajorFragmentProfile::MajorFragmentProfile() + : ::google::protobuf::Message() { + SharedCtor(); +} + +void MajorFragmentProfile::InitAsDefaultInstance() { +} + +MajorFragmentProfile::MajorFragmentProfile(const MajorFragmentProfile& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); +} + +void MajorFragmentProfile::SharedCtor() { + _cached_size_ = 0; + major_fragment_id_ = 0; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +MajorFragmentProfile::~MajorFragmentProfile() { + SharedDtor(); +} + +void MajorFragmentProfile::SharedDtor() { + if (this != default_instance_) { + } +} + +void MajorFragmentProfile::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* MajorFragmentProfile::descriptor() { + protobuf_AssignDescriptorsOnce(); + return MajorFragmentProfile_descriptor_; +} + +const MajorFragmentProfile& MajorFragmentProfile::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_UserBitShared_2eproto(); + return *default_instance_; +} + +MajorFragmentProfile* MajorFragmentProfile::default_instance_ = NULL; + +MajorFragmentProfile* MajorFragmentProfile::New() const { + return new MajorFragmentProfile; +} + +void MajorFragmentProfile::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + major_fragment_id_ = 0; + } + minor_fragment_profile_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool MajorFragmentProfile::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional int32 major_fragment_id = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &major_fragment_id_))); + set_has_major_fragment_id(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(18)) goto parse_minor_fragment_profile; + break; + } + + // repeated .exec.shared.MinorFragmentProfile minor_fragment_profile = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_minor_fragment_profile: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_minor_fragment_profile())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(18)) goto parse_minor_fragment_profile; + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } + return true; +#undef DO_ +} + +void MajorFragmentProfile::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // optional int32 major_fragment_id = 1; + if (has_major_fragment_id()) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->major_fragment_id(), output); + } + + // repeated .exec.shared.MinorFragmentProfile minor_fragment_profile = 2; + for (int i = 0; i < this->minor_fragment_profile_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 2, this->minor_fragment_profile(i), output); + } + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } +} + +::google::protobuf::uint8* MajorFragmentProfile::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // optional int32 major_fragment_id = 1; + if (has_major_fragment_id()) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(1, this->major_fragment_id(), target); + } + + // repeated .exec.shared.MinorFragmentProfile minor_fragment_profile = 2; + for (int i = 0; i < this->minor_fragment_profile_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 2, this->minor_fragment_profile(i), target); + } + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + return target; +} + +int MajorFragmentProfile::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // optional int32 major_fragment_id = 1; + if (has_major_fragment_id()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->major_fragment_id()); + } + + } + // repeated .exec.shared.MinorFragmentProfile minor_fragment_profile = 2; + total_size += 1 * this->minor_fragment_profile_size(); + for (int i = 0; i < this->minor_fragment_profile_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->minor_fragment_profile(i)); + } + + if (!unknown_fields().empty()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void MajorFragmentProfile::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const MajorFragmentProfile* source = + ::google::protobuf::internal::dynamic_cast_if_available<const MajorFragmentProfile*>( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void MajorFragmentProfile::MergeFrom(const MajorFragmentProfile& from) { + GOOGLE_CHECK_NE(&from, this); + minor_fragment_profile_.MergeFrom(from.minor_fragment_profile_); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_major_fragment_id()) { + set_major_fragment_id(from.major_fragment_id()); + } + } + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void MajorFragmentProfile::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void MajorFragmentProfile::CopyFrom(const MajorFragmentProfile& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool MajorFragmentProfile::IsInitialized() const { + + return true; +} + +void MajorFragmentProfile::Swap(MajorFragmentProfile* other) { + if (other != this) { + std::swap(major_fragment_id_, other->major_fragment_id_); + minor_fragment_profile_.Swap(&other->minor_fragment_profile_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _unknown_fields_.Swap(&other->_unknown_fields_); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::google::protobuf::Metadata MajorFragmentProfile::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = MajorFragmentProfile_descriptor_; + metadata.reflection = MajorFragmentProfile_reflection_; + return metadata; +} + + +// =================================================================== + +#ifndef _MSC_VER +const int MinorFragmentProfile::kStateFieldNumber; +const int MinorFragmentProfile::kErrorFieldNumber; +const int MinorFragmentProfile::kMinorFragmentIdFieldNumber; +const int MinorFragmentProfile::kOperatorProfileFieldNumber; +const int MinorFragmentProfile::kStartTimeFieldNumber; +const int MinorFragmentProfile::kEndTimeFieldNumber; +const int MinorFragmentProfile::kMemoryUsedFieldNumber; +const int MinorFragmentProfile::kMaxMemoryUsedFieldNumber; +const int MinorFragmentProfile::kEndpointFieldNumber; +#endif // !_MSC_VER + +MinorFragmentProfile::MinorFragmentProfile() + : ::google::protobuf::Message() { + SharedCtor(); +} + +void MinorFragmentProfile::InitAsDefaultInstance() { + error_ = const_cast< ::exec::shared::DrillPBError*>(&::exec::shared::DrillPBError::default_instance()); + endpoint_ = const_cast< ::exec::DrillbitEndpoint*>(&::exec::DrillbitEndpoint::default_instance()); +} + +MinorFragmentProfile::MinorFragmentProfile(const MinorFragmentProfile& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); +} + +void MinorFragmentProfile::SharedCtor() { + _cached_size_ = 0; + state_ = 0; + error_ = NULL; + minor_fragment_id_ = 0; + start_time_ = GOOGLE_LONGLONG(0); + end_time_ = GOOGLE_LONGLONG(0); + memory_used_ = GOOGLE_LONGLONG(0); + max_memory_used_ = GOOGLE_LONGLONG(0); + endpoint_ = NULL; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +MinorFragmentProfile::~MinorFragmentProfile() { + SharedDtor(); +} + +void MinorFragmentProfile::SharedDtor() { + if (this != default_instance_) { + delete error_; + delete endpoint_; + } +} + +void MinorFragmentProfile::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* MinorFragmentProfile::descriptor() { + protobuf_AssignDescriptorsOnce(); + return MinorFragmentProfile_descriptor_; +} + +const MinorFragmentProfile& MinorFragmentProfile::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_UserBitShared_2eproto(); + return *default_instance_; +} + +MinorFragmentProfile* MinorFragmentProfile::default_instance_ = NULL; + +MinorFragmentProfile* MinorFragmentProfile::New() const { + return new MinorFragmentProfile; +} + +void MinorFragmentProfile::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + state_ = 0; + if (has_error()) { + if (error_ != NULL) error_->::exec::shared::DrillPBError::Clear(); + } + minor_fragment_id_ = 0; + start_time_ = GOOGLE_LONGLONG(0); + end_time_ = GOOGLE_LONGLONG(0); + memory_used_ = GOOGLE_LONGLONG(0); + max_memory_used_ = GOOGLE_LONGLONG(0); + } + if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) { + if (has_endpoint()) { + if (endpoint_ != NULL) endpoint_->::exec::DrillbitEndpoint::Clear(); + } + } + operator_profile_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool MinorFragmentProfile::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional .exec.shared.FragmentState state = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + int value; + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( + input, &value))); + if (::exec::shared::FragmentState_IsValid(value)) { + set_state(static_cast< ::exec::shared::FragmentState >(value)); + } else { + mutable_unknown_fields()->AddVarint(1, value); + } + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(18)) goto parse_error; + break; + } + + // optional .exec.shared.DrillPBError error = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_error: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_error())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(24)) goto parse_minor_fragment_id; + break; + } + + // optional int32 minor_fragment_id = 3; + case 3: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_minor_fragment_id: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &minor_fragment_id_))); + set_has_minor_fragment_id(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(34)) goto parse_operator_profile; + break; + } + + // repeated .exec.shared.OperatorProfile operator_profile = 4; + case 4: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_operator_profile: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_operator_profile())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(34)) goto parse_operator_profile; + if (input->ExpectTag(40)) goto parse_start_time; + break; + } + + // optional int64 start_time = 5; + case 5: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_start_time: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( + input, &start_time_))); + set_has_start_time(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(48)) goto parse_end_time; + break; + } + + // optional int64 end_time = 6; + case 6: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_end_time: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( + input, &end_time_))); + set_has_end_time(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(56)) goto parse_memory_used; + break; + } + + // optional int64 memory_used = 7; + case 7: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_memory_used: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( + input, &memory_used_))); + set_has_memory_used(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(64)) goto parse_max_memory_used; + break; + } + + // optional int64 max_memory_used = 8; + case 8: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_max_memory_used: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( + input, &max_memory_used_))); + set_has_max_memory_used(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(74)) goto parse_endpoint; + break; + } + + // optional .exec.DrillbitEndpoint endpoint = 9; + case 9: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_endpoint: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_endpoint())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } + return true; +#undef DO_ +} + +void MinorFragmentProfile::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // optional .exec.shared.FragmentState state = 1; + if (has_state()) { + ::google::protobuf::internal::WireFormatLite::WriteEnum( + 1, this->state(), output); + } + + // optional .exec.shared.DrillPBError error = 2; + if (has_error()) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 2, this->error(), output); + } + + // optional int32 minor_fragment_id = 3; + if (has_minor_fragment_id()) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(3, this->minor_fragment_id(), output); + } + + // repeated .exec.shared.OperatorProfile operator_profile = 4; + for (int i = 0; i < this->operator_profile_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 4, this->operator_profile(i), output); + } + + // optional int64 start_time = 5; + if (has_start_time()) { + ::google::protobuf::internal::WireFormatLite::WriteInt64(5, this->start_time(), output); + } + + // optional int64 end_time = 6; + if (has_end_time()) { + ::google::protobuf::internal::WireFormatLite::WriteInt64(6, this->end_time(), output); + } + + // optional int64 memory_used = 7; + if (has_memory_used()) { + ::google::protobuf::internal::WireFormatLite::WriteInt64(7, this->memory_used(), output); + } + + // optional int64 max_memory_used = 8; + if (has_max_memory_used()) { + ::google::protobuf::internal::WireFormatLite::WriteInt64(8, this->max_memory_used(), output); + } + + // optional .exec.DrillbitEndpoint endpoint = 9; + if (has_endpoint()) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 9, this->endpoint(), output); + } + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } +} + +::google::protobuf::uint8* MinorFragmentProfile::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // optional .exec.shared.FragmentState state = 1; + if (has_state()) { + target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray( + 1, this->state(), target); + } + + // optional .exec.shared.DrillPBError error = 2; + if (has_error()) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 2, this->error(), target); + } + + // optional int32 minor_fragment_id = 3; + if (has_minor_fragment_id()) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(3, this->minor_fragment_id(), target); + } + + // repeated .exec.shared.OperatorProfile operator_profile = 4; + for (int i = 0; i < this->operator_profile_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 4, this->operator_profile(i), target); + } + + // optional int64 start_time = 5; + if (has_start_time()) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(5, this->start_time(), target); + } + + // optional int64 end_time = 6; + if (has_end_time()) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(6, this->end_time(), target); + } + + // optional int64 memory_used = 7; + if (has_memory_used()) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(7, this->memory_used(), target); + } + + // optional int64 max_memory_used = 8; + if (has_max_memory_used()) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(8, this->max_memory_used(), target); + } + + // optional .exec.DrillbitEndpoint endpoint = 9; + if (has_endpoint()) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 9, this->endpoint(), target); + } + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + return target; +} + +int MinorFragmentProfile::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // optional .exec.shared.FragmentState state = 1; + if (has_state()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::EnumSize(this->state()); + } + + // optional .exec.shared.DrillPBError error = 2; + if (has_error()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->error()); + } + + // optional int32 minor_fragment_id = 3; + if (has_minor_fragment_id()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->minor_fragment_id()); + } + + // optional int64 start_time = 5; + if (has_start_time()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int64Size( + this->start_time()); + } + + // optional int64 end_time = 6; + if (has_end_time()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int64Size( + this->end_time()); + } + + // optional int64 memory_used = 7; + if (has_memory_used()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int64Size( + this->memory_used()); + } + + // optional int64 max_memory_used = 8; + if (has_max_memory_used()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int64Size( + this->max_memory_used()); + } + + } + if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) { + // optional .exec.DrillbitEndpoint endpoint = 9; + if (has_endpoint()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->endpoint()); + } + + } + // repeated .exec.shared.OperatorProfile operator_profile = 4; + total_size += 1 * this->operator_profile_size(); + for (int i = 0; i < this->operator_profile_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->operator_profile(i)); + } + + if (!unknown_fields().empty()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void MinorFragmentProfile::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const MinorFragmentProfile* source = + ::google::protobuf::internal::dynamic_cast_if_available<const MinorFragmentProfile*>( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void MinorFragmentProfile::MergeFrom(const MinorFragmentProfile& from) { + GOOGLE_CHECK_NE(&from, this); + operator_profile_.MergeFrom(from.operator_profile_); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_state()) { + set_state(from.state()); + } + if (from.has_error()) { + mutable_error()->::exec::shared::DrillPBError::MergeFrom(from.error()); + } + if (from.has_minor_fragment_id()) { + set_minor_fragment_id(from.minor_fragment_id()); + } + if (from.has_start_time()) { + set_start_time(from.start_time()); + } + if (from.has_end_time()) { + set_end_time(from.end_time()); + } + if (from.has_memory_used()) { + set_memory_used(from.memory_used()); + } + if (from.has_max_memory_used()) { + set_max_memory_used(from.max_memory_used()); + } + } + if (from._has_bits_[8 / 32] & (0xffu << (8 % 32))) { + if (from.has_endpoint()) { + mutable_endpoint()->::exec::DrillbitEndpoint::MergeFrom(from.endpoint()); + } + } + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void MinorFragmentProfile::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void MinorFragmentProfile::CopyFrom(const MinorFragmentProfile& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool MinorFragmentProfile::IsInitialized() const { + + return true; +} + +void MinorFragmentProfile::Swap(MinorFragmentProfile* other) { + if (other != this) { + std::swap(state_, other->state_); + std::swap(error_, other->error_); + std::swap(minor_fragment_id_, other->minor_fragment_id_); + operator_profile_.Swap(&other->operator_profile_); + std::swap(start_time_, other->start_time_); + std::swap(end_time_, other->end_time_); + std::swap(memory_used_, other->memory_used_); + std::swap(max_memory_used_, other->max_memory_used_); + std::swap(endpoint_, other->endpoint_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _unknown_fields_.Swap(&other->_unknown_fields_); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::google::protobuf::Metadata MinorFragmentProfile::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = MinorFragmentProfile_descriptor_; + metadata.reflection = MinorFragmentProfile_reflection_; + return metadata; +} + + +// =================================================================== + +#ifndef _MSC_VER +const int OperatorProfile::kInputProfileFieldNumber; +const int OperatorProfile::kOperatorIdFieldNumber; +const int OperatorProfile::kOperatorTypeFieldNumber; +const int OperatorProfile::kSetupNanosFieldNumber; +const int OperatorProfile::kProcessNanosFieldNumber; +const int OperatorProfile::kLocalMemoryAllocatedFieldNumber; +const int OperatorProfile::kMetricFieldNumber; +#endif // !_MSC_VER + +OperatorProfile::OperatorProfile() + : ::google::protobuf::Message() { + SharedCtor(); +} + +void OperatorProfile::InitAsDefaultInstance() { +} + +OperatorProfile::OperatorProfile(const OperatorProfile& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); +} + +void OperatorProfile::SharedCtor() { + _cached_size_ = 0; + operator_id_ = 0; + operator_type_ = 0; + setup_nanos_ = GOOGLE_LONGLONG(0); + process_nanos_ = GOOGLE_LONGLONG(0); + local_memory_allocated_ = GOOGLE_LONGLONG(0); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +OperatorProfile::~OperatorProfile() { + SharedDtor(); +} + +void OperatorProfile::SharedDtor() { + if (this != default_instance_) { + } +} + +void OperatorProfile::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* OperatorProfile::descriptor() { + protobuf_AssignDescriptorsOnce(); + return OperatorProfile_descriptor_; +} + +const OperatorProfile& OperatorProfile::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_UserBitShared_2eproto(); + return *default_instance_; +} + +OperatorProfile* OperatorProfile::default_instance_ = NULL; + +OperatorProfile* OperatorProfile::New() const { + return new OperatorProfile; +} + +void OperatorProfile::Clear() { + if (_has_bits_[1 / 32] & (0xffu << (1 % 32))) { + operator_id_ = 0; + operator_type_ = 0; + setup_nanos_ = GOOGLE_LONGLONG(0); + process_nanos_ = GOOGLE_LONGLONG(0); + local_memory_allocated_ = GOOGLE_LONGLONG(0); + } + input_profile_.Clear(); + metric_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool OperatorProfile::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // repeated .exec.shared.StreamProfile input_profile = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_input_profile: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_input_profile())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(10)) goto parse_input_profile; + if (input->ExpectTag(24)) goto parse_operator_id; + break; + } + + // optional int32 operator_id = 3; + case 3: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_operator_id: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &operator_id_))); + set_has_operator_id(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(32)) goto parse_operator_type; + break; + } + + // optional int32 operator_type = 4; + case 4: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_operator_type: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &operator_type_))); + set_has_operator_type(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(40)) goto parse_setup_nanos; + break; + } + + // optional int64 setup_nanos = 5; + case 5: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_setup_nanos: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( + input, &setup_nanos_))); + set_has_setup_nanos(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(48)) goto parse_process_nanos; + break; + } + + // optional int64 process_nanos = 6; + case 6: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_process_nanos: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( + input, &process_nanos_))); + set_has_process_nanos(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(56)) goto parse_local_memory_allocated; + break; + } + + // optional int64 local_memory_allocated = 7; + case 7: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_local_memory_allocated: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( + input, &local_memory_allocated_))); + set_has_local_memory_allocated(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(66)) goto parse_metric; + break; + } + + // repeated .exec.shared.MetricValue metric = 8; + case 8: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_metric: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_metric())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(66)) goto parse_metric; + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } + return true; +#undef DO_ +} + +void OperatorProfile::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // repeated .exec.shared.StreamProfile input_profile = 1; + for (int i = 0; i < this->input_profile_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 1, this->input_profile(i), output); + } + + // optional int32 operator_id = 3; + if (has_operator_id()) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(3, this->operator_id(), output); + } + + // optional int32 operator_type = 4; + if (has_operator_type()) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(4, this->operator_type(), output); + } + + // optional int64 setup_nanos = 5; + if (has_setup_nanos()) { + ::google::protobuf::internal::WireFormatLite::WriteInt64(5, this->setup_nanos(), output); + } + + // optional int64 process_nanos = 6; + if (has_process_nanos()) { + ::google::protobuf::internal::WireFormatLite::WriteInt64(6, this->process_nanos(), output); + } + + // optional int64 local_memory_allocated = 7; + if (has_local_memory_allocated()) { + ::google::protobuf::internal::WireFormatLite::WriteInt64(7, this->local_memory_allocated(), output); + } + + // repeated .exec.shared.MetricValue metric = 8; + for (int i = 0; i < this->metric_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 8, this->metric(i), output); + } + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } +} + +::google::protobuf::uint8* OperatorProfile::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // repeated .exec.shared.StreamProfile input_profile = 1; + for (int i = 0; i < this->input_profile_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 1, this->input_profile(i), target); + } + + // optional int32 operator_id = 3; + if (has_operator_id()) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(3, this->operator_id(), target); + } + + // optional int32 operator_type = 4; + if (has_operator_type()) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(4, this->operator_type(), target); + } + + // optional int64 setup_nanos = 5; + if (has_setup_nanos()) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(5, this->setup_nanos(), target); + } + + // optional int64 process_nanos = 6; + if (has_process_nanos()) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(6, this->process_nanos(), target); + } + + // optional int64 local_memory_allocated = 7; + if (has_local_memory_allocated()) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(7, this->local_memory_allocated(), target); + } + + // repeated .exec.shared.MetricValue metric = 8; + for (int i = 0; i < this->metric_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 8, this->metric(i), target); + } + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + return target; +} + +int OperatorProfile::ByteSize() const { + int total_size = 0; + + if (_has_bits_[1 / 32] & (0xffu << (1 % 32))) { + // optional int32 operator_id = 3; + if (has_operator_id()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->operator_id()); + } + + // optional int32 operator_type = 4; + if (has_operator_type()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->operator_type()); + } + + // optional int64 setup_nanos = 5; + if (has_setup_nanos()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int64Size( + this->setup_nanos()); + } + + // optional int64 process_nanos = 6; + if (has_process_nanos()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int64Size( + this->process_nanos()); + } + + // optional int64 local_memory_allocated = 7; + if (has_local_memory_allocated()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int64Size( + this->local_memory_allocated()); + } + + } + // repeated .exec.shared.StreamProfile input_profile = 1; + total_size += 1 * this->input_profile_size(); + for (int i = 0; i < this->input_profile_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->input_profile(i)); + } + + // repeated .exec.shared.MetricValue metric = 8; + total_size += 1 * this->metric_size(); + for (int i = 0; i < this->metric_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->metric(i)); + } + + if (!unknown_fields().empty()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void OperatorProfile::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const OperatorProfile* source = + ::google::protobuf::internal::dynamic_cast_if_available<const OperatorProfile*>( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void OperatorProfile::MergeFrom(const OperatorProfile& from) { + GOOGLE_CHECK_NE(&from, this); + input_profile_.MergeFrom(from.input_profile_); + metric_.MergeFrom(from.metric_); + if (from._has_bits_[1 / 32] & (0xffu << (1 % 32))) { + if (from.has_operator_id()) { + set_operator_id(from.operator_id()); + } + if (from.has_operator_type()) { + set_operator_type(from.operator_type()); + } + if (from.has_setup_nanos()) { + set_setup_nanos(from.setup_nanos()); + } + if (from.has_process_nanos()) { + set_process_nanos(from.process_nanos()); + } + if (from.has_local_memory_allocated()) { + set_local_memory_allocated(from.local_memory_allocated()); + } + } + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void OperatorProfile::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void OperatorProfile::CopyFrom(const OperatorProfile& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool OperatorProfile::IsInitialized() const { + + return true; +} + +void OperatorProfile::Swap(OperatorProfile* other) { + if (other != this) { + input_profile_.Swap(&other->input_profile_); + std::swap(operator_id_, other->operator_id_); + std::swap(operator_type_, other->operator_type_); + std::swap(setup_nanos_, other->setup_nanos_); + std::swap(process_nanos_, other->process_nanos_); + std::swap(local_memory_allocated_, other->local_memory_allocated_); + metric_.Swap(&other->metric_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _unknown_fields_.Swap(&other->_unknown_fields_); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::google::protobuf::Metadata OperatorProfile::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = OperatorProfile_descriptor_; + metadata.reflection = OperatorProfile_reflection_; + return metadata; +} + + +// =================================================================== + +#ifndef _MSC_VER +const int StreamProfile::kRecordsFieldNumber; +const int StreamProfile::kBatchesFieldNumber; +const int StreamProfile::kSchemasFieldNumber; +#endif // !_MSC_VER + +StreamProfile::StreamProfile() + : ::google::protobuf::Message() { + SharedCtor(); +} + +void StreamProfile::InitAsDefaultInstance() { +} + +StreamProfile::StreamProfile(const StreamProfile& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); +} + +void StreamProfile::SharedCtor() { + _cached_size_ = 0; + records_ = GOOGLE_LONGLONG(0); + batches_ = GOOGLE_LONGLONG(0); + schemas_ = GOOGLE_LONGLONG(0); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +StreamProfile::~StreamProfile() { + SharedDtor(); +} + +void StreamProfile::SharedDtor() { + if (this != default_instance_) { + } +} + +void StreamProfile::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* StreamProfile::descriptor() { + protobuf_AssignDescriptorsOnce(); + return StreamProfile_descriptor_; +} + +const StreamProfile& StreamProfile::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_UserBitShared_2eproto(); + return *default_instance_; +} + +StreamProfile* StreamProfile::default_instance_ = NULL; + +StreamProfile* StreamProfile::New() const { + return new StreamProfile; +} + +void StreamProfile::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + records_ = GOOGLE_LONGLONG(0); + batches_ = GOOGLE_LONGLONG(0); + schemas_ = GOOGLE_LONGLONG(0); + } + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool StreamProfile::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional int64 records = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( + input, &records_))); + set_has_records(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(16)) goto parse_batches; + break; + } + + // optional int64 batches = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_batches: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( + input, &batches_))); + set_has_batches(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(24)) goto parse_schemas; + break; + } + + // optional int64 schemas = 3; + case 3: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_schemas: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( + input, &schemas_))); + set_has_schemas(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } + return true; +#undef DO_ +} + +void StreamProfile::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // optional int64 records = 1; + if (has_records()) { + ::google::protobuf::internal::WireFormatLite::WriteInt64(1, this->records(), output); + } + + // optional int64 batches = 2; + if (has_batches()) { + ::google::protobuf::internal::WireFormatLite::WriteInt64(2, this->batches(), output); + } + + // optional int64 schemas = 3; + if (has_schemas()) { + ::google::protobuf::internal::WireFormatLite::WriteInt64(3, this->schemas(), output); + } + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } +} + +::google::protobuf::uint8* StreamProfile::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // optional int64 records = 1; + if (has_records()) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(1, this->records(), target); + } + + // optional int64 batches = 2; + if (has_batches()) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(2, this->batches(), target); + } + + // optional int64 schemas = 3; + if (has_schemas()) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(3, this->schemas(), target); + } + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + return target; +} + +int StreamProfile::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // optional int64 records = 1; + if (has_records()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int64Size( + this->records()); + } + + // optional int64 batches = 2; + if (has_batches()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int64Size( + this->batches()); + } + + // optional int64 schemas = 3; + if (has_schemas()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int64Size( + this->schemas()); + } + + } + if (!unknown_fields().empty()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void StreamProfile::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const StreamProfile* source = + ::google::protobuf::internal::dynamic_cast_if_available<const StreamProfile*>( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void StreamProfile::MergeFrom(const StreamProfile& from) { + GOOGLE_CHECK_NE(&from, this); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_records()) { + set_records(from.records()); + } + if (from.has_batches()) { + set_batches(from.batches()); + } + if (from.has_schemas()) { + set_schemas(from.schemas()); + } + } + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void StreamProfile::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void StreamProfile::CopyFrom(const StreamProfile& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool StreamProfile::IsInitialized() const { + + return true; +} + +void StreamProfile::Swap(StreamProfile* other) { + if (other != this) { + std::swap(records_, other->records_); + std::swap(batches_, other->batches_); + std::swap(schemas_, other->schemas_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _unknown_fields_.Swap(&other->_unknown_fields_); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::google::protobuf::Metadata StreamProfile::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = StreamProfile_descriptor_; + metadata.reflection = StreamProfile_reflection_; + return metadata; +} + + +// =================================================================== + +#ifndef _MSC_VER +const int MetricValue::kMetricIdFieldNumber; +const int MetricValue::kLongValueFieldNumber; +const int MetricValue::kDoubleValueFieldNumber; +#endif // !_MSC_VER + +MetricValue::MetricValue() + : ::google::protobuf::Message() { + SharedCtor(); +} + +void MetricValue::InitAsDefaultInstance() { +} + +MetricValue::MetricValue(const MetricValue& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); +} + +void MetricValue::SharedCtor() { + _cached_size_ = 0; + metric_id_ = 0; + long_value_ = GOOGLE_LONGLONG(0); + double_value_ = 0; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +MetricValue::~MetricValue() { + SharedDtor(); +} + +void MetricValue::SharedDtor() { + if (this != default_instance_) { + } +} + +void MetricValue::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* MetricValue::descriptor() { + protobuf_AssignDescriptorsOnce(); + return MetricValue_descriptor_; +} + +const MetricValue& MetricValue::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_UserBitShared_2eproto(); + return *default_instance_; +} + +MetricValue* MetricValue::default_instance_ = NULL; + +MetricValue* MetricValue::New() const { + return new MetricValue; +} + +void MetricValue::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + metric_id_ = 0; + long_value_ = GOOGLE_LONGLONG(0); + double_value_ = 0; + } + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool MetricValue::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional int32 metric_id = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &metric_id_))); + set_has_metric_id(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(16)) goto parse_long_value; + break; + } + + // optional int64 long_value = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_long_value: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( + input, &long_value_))); + set_has_long_value(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(25)) goto parse_double_value; + break; + } + + // optional double double_value = 3; + case 3: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_FIXED64) { + parse_double_value: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>( + input, &double_value_))); + set_has_double_value(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } + return true; +#undef DO_ +} + +void MetricValue::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // optional int32 metric_id = 1; + if (has_metric_id()) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->metric_id(), output); + } + + // optional int64 long_value = 2; + if (has_long_value()) { + ::google::protobuf::internal::WireFormatLite::WriteInt64(2, this->long_value(), output); + } + + // optional double double_value = 3; + if (has_double_value()) { + ::google::protobuf::internal::WireFormatLite::WriteDouble(3, this->double_value(), output); + } + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } +} + +::google::protobuf::uint8* MetricValue::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // optional int32 metric_id = 1; + if (has_metric_id()) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(1, this->metric_id(), target); + } + + // optional int64 long_value = 2; + if (has_long_value()) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(2, this->long_value(), target); + } + + // optional double double_value = 3; + if (has_double_value()) { + target = ::google::protobuf::internal::WireFormatLite::WriteDoubleToArray(3, this->double_value(), target); + } + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + return target; +} + +int MetricValue::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // optional int32 metric_id = 1; + if (has_metric_id()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->metric_id()); + } + + // optional int64 long_value = 2; + if (has_long_value()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int64Size( + this->long_value()); + } + + // optional double double_value = 3; + if (has_double_value()) { + total_size += 1 + 8; + } + + } + if (!unknown_fields().empty()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void MetricValue::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const MetricValue* source = + ::google::protobuf::internal::dynamic_cast_if_available<const MetricValue*>( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void MetricValue::MergeFrom(const MetricValue& from) { + GOOGLE_CHECK_NE(&from, this); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_metric_id()) { + set_metric_id(from.metric_id()); + } + if (from.has_long_value()) { + set_long_value(from.long_value()); + } + if (from.has_double_value()) { + set_double_value(from.double_value()); + } + } + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void MetricValue::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void MetricValue::CopyFrom(const MetricValue& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool MetricValue::IsInitialized() const { + + return true; +} + +void MetricValue::Swap(MetricValue* other) { + if (other != this) { + std::swap(metric_id_, other->metric_id_); + std::swap(long_value_, other->long_value_); + std::swap(double_value_, other->double_value_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _unknown_fields_.Swap(&other->_unknown_fields_); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::google::protobuf::Metadata MetricValue::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = MetricValue_descriptor_; + metadata.reflection = MetricValue_reflection_; + return metadata; +} + + // @@protoc_insertion_point(namespace_scope) } // namespace shared diff --git a/contrib/native/client/src/protobuf/UserBitShared.pb.h b/contrib/native/client/src/protobuf/UserBitShared.pb.h index fb7890442..ece6b7b38 100644 --- a/contrib/native/client/src/protobuf/UserBitShared.pb.h +++ b/contrib/native/client/src/protobuf/UserBitShared.pb.h @@ -45,6 +45,12 @@ class ParsingError; class RecordBatchDef; class NamePart; class SerializedField; +class QueryProfile; +class MajorFragmentProfile; +class MinorFragmentProfile; +class OperatorProfile; +class StreamProfile; +class MetricValue; enum NamePart_Type { NamePart_Type_NAME = 0, @@ -85,6 +91,97 @@ inline bool RpcChannel_Parse( return ::google::protobuf::internal::ParseNamedEnum<RpcChannel>( RpcChannel_descriptor(), name, value); } +enum QueryType { + SQL = 1, + LOGICAL = 2, + PHYSICAL = 3 +}; +bool QueryType_IsValid(int value); +const QueryType QueryType_MIN = SQL; +const QueryType QueryType_MAX = PHYSICAL; +const int QueryType_ARRAYSIZE = QueryType_MAX + 1; + +const ::google::protobuf::EnumDescriptor* QueryType_descriptor(); +inline const ::std::string& QueryType_Name(QueryType value) { + return ::google::protobuf::internal::NameOfEnum( + QueryType_descriptor(), value); +} +inline bool QueryType_Parse( + const ::std::string& name, QueryType* value) { + return ::google::protobuf::internal::ParseNamedEnum<QueryType>( + QueryType_descriptor(), name, value); +} +enum FragmentState { + SENDING = 0, + AWAITING_ALLOCATION = 1, + RUNNING = 2, + FINISHED = 3, + CANCELLED = 4, + FAILED = 5 +}; +bool FragmentState_IsValid(int value); +const FragmentState FragmentState_MIN = SENDING; +const FragmentState FragmentState_MAX = FAILED; +const int FragmentState_ARRAYSIZE = FragmentState_MAX + 1; + +const ::google::protobuf::EnumDescriptor* FragmentState_descriptor(); +inline const ::std::string& FragmentState_Name(FragmentState value) { + return ::google::protobuf::internal::NameOfEnum( + FragmentState_descriptor(), value); +} +inline bool FragmentState_Parse( + const ::std::string& name, FragmentState* value) { + return ::google::protobuf::internal::ParseNamedEnum<FragmentState>( + FragmentState_descriptor(), name, value); +} +enum CoreOperatorType { + SINGLE_SENDER = 0, + BROADCAST_SENDER = 1, + FILTER = 2, + HASH_AGGREGATE = 3, + HASH_JOIN = 4, + MERGE_JOIN = 5, + HASH_PARTITION_SENDER = 6, + LIMIT = 7, + MERGING_RECEIVER = 8, + ORDERED_PARTITION_SENDER = 9, + PROJECT = 10, + RANDOM_RECEIVER = 11, + RANGE_SENDER = 12, + SCREEN = 13, + SELECTION_VECTOR_REMOVER = 14, + STREAMING_AGGREGATE = 15, + TOP_N_SORT = 16, + EXTERNAL_SORT = 17, + TRACE = 18, + UNION = 19, + OLD_SORT = 20, + PARQUET_ROW_GROUP_SCAN = 21, + HIVE_SUB_SCAN = 22, + SYSTEM_TABLE_SCAN = 23, + MOCK_SUB_SCAN = 24, + PARQUET_WRITER = 25, + DIRECT_SUB_SCAN = 26, + TEXT_WRITER = 27, + TEXT_SUB_SCAN = 28, + JSON_SUB_SCAN = 29, + INFO_SCHEMA_SUB_SCAN = 30 +}; +bool CoreOperatorType_IsValid(int value); +const CoreOperatorType CoreOperatorType_MIN = SINGLE_SENDER; +const CoreOperatorType CoreOperatorType_MAX = INFO_SCHEMA_SUB_SCAN; +const int CoreOperatorType_ARRAYSIZE = CoreOperatorType_MAX + 1; + +const ::google::protobuf::EnumDescriptor* CoreOperatorType_descriptor(); +inline const ::std::string& CoreOperatorType_Name(CoreOperatorType value) { + return ::google::protobuf::internal::NameOfEnum( + CoreOperatorType_descriptor(), value); +} +inline bool CoreOperatorType_Parse( + const ::std::string& name, CoreOperatorType* value) { + return ::google::protobuf::internal::ParseNamedEnum<CoreOperatorType>( + CoreOperatorType_descriptor(), name, value); +} // =================================================================== class UserCredentials : public ::google::protobuf::Message { @@ -900,6 +997,779 @@ class SerializedField : public ::google::protobuf::Message { void InitAsDefaultInstance(); static SerializedField* default_instance_; }; +// ------------------------------------------------------------------- + +class QueryProfile : public ::google::protobuf::Message { + public: + QueryProfile(); + virtual ~QueryProfile(); + + QueryProfile(const QueryProfile& from); + + inline QueryProfile& operator=(const QueryProfile& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const QueryProfile& default_instance(); + + void Swap(QueryProfile* other); + + // implements Message ---------------------------------------------- + + QueryProfile* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const QueryProfile& from); + void MergeFrom(const QueryProfile& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional .exec.shared.QueryId id = 1; + inline bool has_id() const; + inline void clear_id(); + static const int kIdFieldNumber = 1; + inline const ::exec::shared::QueryId& id() const; + inline ::exec::shared::QueryId* mutable_id(); + inline ::exec::shared::QueryId* release_id(); + inline void set_allocated_id(::exec::shared::QueryId* id); + + // optional .exec.shared.QueryType type = 2; + inline bool has_type() const; + inline void clear_type(); + static const int kTypeFieldNumber = 2; + inline ::exec::shared::QueryType type() const; + inline void set_type(::exec::shared::QueryType value); + + // optional int64 start = 3; + inline bool has_start() const; + inline void clear_start(); + static const int kStartFieldNumber = 3; + inline ::google::protobuf::int64 start() const; + inline void set_start(::google::protobuf::int64 value); + + // optional int64 end = 4; + inline bool has_end() const; + inline void clear_end(); + static const int kEndFieldNumber = 4; + inline ::google::protobuf::int64 end() const; + inline void set_end(::google::protobuf::int64 value); + + // optional string query = 5; + inline bool has_query() const; + inline void clear_query(); + static const int kQueryFieldNumber = 5; + inline const ::std::string& query() const; + inline void set_query(const ::std::string& value); + inline void set_query(const char* value); + inline void set_query(const char* value, size_t size); + inline ::std::string* mutable_query(); + inline ::std::string* release_query(); + inline void set_allocated_query(::std::string* query); + + // optional string plan = 6; + inline bool has_plan() const; + inline void clear_plan(); + static const int kPlanFieldNumber = 6; + inline const ::std::string& plan() const; + inline void set_plan(const ::std::string& value); + inline void set_plan(const char* value); + inline void set_plan(const char* value, size_t size); + inline ::std::string* mutable_plan(); + inline ::std::string* release_plan(); + inline void set_allocated_plan(::std::string* plan); + + // repeated .exec.shared.MajorFragmentProfile fragment_profile = 7; + inline int fragment_profile_size() const; + inline void clear_fragment_profile(); + static const int kFragmentProfileFieldNumber = 7; + inline const ::exec::shared::MajorFragmentProfile& fragment_profile(int index) const; + inline ::exec::shared::MajorFragmentProfile* mutable_fragment_profile(int index); + inline ::exec::shared::MajorFragmentProfile* add_fragment_profile(); + inline const ::google::protobuf::RepeatedPtrField< ::exec::shared::MajorFragmentProfile >& + fragment_profile() const; + inline ::google::protobuf::RepeatedPtrField< ::exec::shared::MajorFragmentProfile >* + mutable_fragment_profile(); + + // @@protoc_insertion_point(class_scope:exec.shared.QueryProfile) + private: + inline void set_has_id(); + inline void clear_has_id(); + inline void set_has_type(); + inline void clear_has_type(); + inline void set_has_start(); + inline void clear_has_start(); + inline void set_has_end(); + inline void clear_has_end(); + inline void set_has_query(); + inline void clear_has_query(); + inline void set_has_plan(); + inline void clear_has_plan(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::exec::shared::QueryId* id_; + ::google::protobuf::int64 start_; + ::google::protobuf::int64 end_; + ::std::string* query_; + ::std::string* plan_; + ::google::protobuf::RepeatedPtrField< ::exec::shared::MajorFragmentProfile > fragment_profile_; + int type_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(7 + 31) / 32]; + + friend void protobuf_AddDesc_UserBitShared_2eproto(); + friend void protobuf_AssignDesc_UserBitShared_2eproto(); + friend void protobuf_ShutdownFile_UserBitShared_2eproto(); + + void InitAsDefaultInstance(); + static QueryProfile* default_instance_; +}; +// ------------------------------------------------------------------- + +class MajorFragmentProfile : public ::google::protobuf::Message { + public: + MajorFragmentProfile(); + virtual ~MajorFragmentProfile(); + + MajorFragmentProfile(const MajorFragmentProfile& from); + + inline MajorFragmentProfile& operator=(const MajorFragmentProfile& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const MajorFragmentProfile& default_instance(); + + void Swap(MajorFragmentProfile* other); + + // implements Message ---------------------------------------------- + + MajorFragmentProfile* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const MajorFragmentProfile& from); + void MergeFrom(const MajorFragmentProfile& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional int32 major_fragment_id = 1; + inline bool has_major_fragment_id() const; + inline void clear_major_fragment_id(); + static const int kMajorFragmentIdFieldNumber = 1; + inline ::google::protobuf::int32 major_fragment_id() const; + inline void set_major_fragment_id(::google::protobuf::int32 value); + + // repeated .exec.shared.MinorFragmentProfile minor_fragment_profile = 2; + inline int minor_fragment_profile_size() const; + inline void clear_minor_fragment_profile(); + static const int kMinorFragmentProfileFieldNumber = 2; + inline const ::exec::shared::MinorFragmentProfile& minor_fragment_profile(int index) const; + inline ::exec::shared::MinorFragmentProfile* mutable_minor_fragment_profile(int index); + inline ::exec::shared::MinorFragmentProfile* add_minor_fragment_profile(); + inline const ::google::protobuf::RepeatedPtrField< ::exec::shared::MinorFragmentProfile >& + minor_fragment_profile() const; + inline ::google::protobuf::RepeatedPtrField< ::exec::shared::MinorFragmentProfile >* + mutable_minor_fragment_profile(); + + // @@protoc_insertion_point(class_scope:exec.shared.MajorFragmentProfile) + private: + inline void set_has_major_fragment_id(); + inline void clear_has_major_fragment_id(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::RepeatedPtrField< ::exec::shared::MinorFragmentProfile > minor_fragment_profile_; + ::google::protobuf::int32 major_fragment_id_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; + + friend void protobuf_AddDesc_UserBitShared_2eproto(); + friend void protobuf_AssignDesc_UserBitShared_2eproto(); + friend void protobuf_ShutdownFile_UserBitShared_2eproto(); + + void InitAsDefaultInstance(); + static MajorFragmentProfile* default_instance_; +}; +// ------------------------------------------------------------------- + +class MinorFragmentProfile : public ::google::protobuf::Message { + public: + MinorFragmentProfile(); + virtual ~MinorFragmentProfile(); + + MinorFragmentProfile(const MinorFragmentProfile& from); + + inline MinorFragmentProfile& operator=(const MinorFragmentProfile& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const MinorFragmentProfile& default_instance(); + + void Swap(MinorFragmentProfile* other); + + // implements Message ---------------------------------------------- + + MinorFragmentProfile* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const MinorFragmentProfile& from); + void MergeFrom(const MinorFragmentProfile& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional .exec.shared.FragmentState state = 1; + inline bool has_state() const; + inline void clear_state(); + static const int kStateFieldNumber = 1; + inline ::exec::shared::FragmentState state() const; + inline void set_state(::exec::shared::FragmentState value); + + // optional .exec.shared.DrillPBError error = 2; + inline bool has_error() const; + inline void clear_error(); + static const int kErrorFieldNumber = 2; + inline const ::exec::shared::DrillPBError& error() const; + inline ::exec::shared::DrillPBError* mutable_error(); + inline ::exec::shared::DrillPBError* release_error(); + inline void set_allocated_error(::exec::shared::DrillPBError* error); + + // optional int32 minor_fragment_id = 3; + inline bool has_minor_fragment_id() const; + inline void clear_minor_fragment_id(); + static const int kMinorFragmentIdFieldNumber = 3; + inline ::google::protobuf::int32 minor_fragment_id() const; + inline void set_minor_fragment_id(::google::protobuf::int32 value); + + // repeated .exec.shared.OperatorProfile operator_profile = 4; + inline int operator_profile_size() const; + inline void clear_operator_profile(); + static const int kOperatorProfileFieldNumber = 4; + inline const ::exec::shared::OperatorProfile& operator_profile(int index) const; + inline ::exec::shared::OperatorProfile* mutable_operator_profile(int index); + inline ::exec::shared::OperatorProfile* add_operator_profile(); + inline const ::google::protobuf::RepeatedPtrField< ::exec::shared::OperatorProfile >& + operator_profile() const; + inline ::google::protobuf::RepeatedPtrField< ::exec::shared::OperatorProfile >* + mutable_operator_profile(); + + // optional int64 start_time = 5; + inline bool has_start_time() const; + inline void clear_start_time(); + static const int kStartTimeFieldNumber = 5; + inline ::google::protobuf::int64 start_time() const; + inline void set_start_time(::google::protobuf::int64 value); + + // optional int64 end_time = 6; + inline bool has_end_time() const; + inline void clear_end_time(); + static const int kEndTimeFieldNumber = 6; + inline ::google::protobuf::int64 end_time() const; + inline void set_end_time(::google::protobuf::int64 value); + + // optional int64 memory_used = 7; + inline bool has_memory_used() const; + inline void clear_memory_used(); + static const int kMemoryUsedFieldNumber = 7; + inline ::google::protobuf::int64 memory_used() const; + inline void set_memory_used(::google::protobuf::int64 value); + + // optional int64 max_memory_used = 8; + inline bool has_max_memory_used() const; + inline void clear_max_memory_used(); + static const int kMaxMemoryUsedFieldNumber = 8; + inline ::google::protobuf::int64 max_memory_used() const; + inline void set_max_memory_used(::google::protobuf::int64 value); + + // optional .exec.DrillbitEndpoint endpoint = 9; + inline bool has_endpoint() const; + inline void clear_endpoint(); + static const int kEndpointFieldNumber = 9; + inline const ::exec::DrillbitEndpoint& endpoint() const; + inline ::exec::DrillbitEndpoint* mutable_endpoint(); + inline ::exec::DrillbitEndpoint* release_endpoint(); + inline void set_allocated_endpoint(::exec::DrillbitEndpoint* endpoint); + + // @@protoc_insertion_point(class_scope:exec.shared.MinorFragmentProfile) + private: + inline void set_has_state(); + inline void clear_has_state(); + inline void set_has_error(); + inline void clear_has_error(); + inline void set_has_minor_fragment_id(); + inline void clear_has_minor_fragment_id(); + inline void set_has_start_time(); + inline void clear_has_start_time(); + inline void set_has_end_time(); + inline void clear_has_end_time(); + inline void set_has_memory_used(); + inline void clear_has_memory_used(); + inline void set_has_max_memory_used(); + inline void clear_has_max_memory_used(); + inline void set_has_endpoint(); + inline void clear_has_endpoint(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::exec::shared::DrillPBError* error_; + int state_; + ::google::protobuf::int32 minor_fragment_id_; + ::google::protobuf::RepeatedPtrField< ::exec::shared::OperatorProfile > operator_profile_; + ::google::protobuf::int64 start_time_; + ::google::protobuf::int64 end_time_; + ::google::protobuf::int64 memory_used_; + ::google::protobuf::int64 max_memory_used_; + ::exec::DrillbitEndpoint* endpoint_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(9 + 31) / 32]; + + friend void protobuf_AddDesc_UserBitShared_2eproto(); + friend void protobuf_AssignDesc_UserBitShared_2eproto(); + friend void protobuf_ShutdownFile_UserBitShared_2eproto(); + + void InitAsDefaultInstance(); + static MinorFragmentProfile* default_instance_; +}; +// ------------------------------------------------------------------- + +class OperatorProfile : public ::google::protobuf::Message { + public: + OperatorProfile(); + virtual ~OperatorProfile(); + + OperatorProfile(const OperatorProfile& from); + + inline OperatorProfile& operator=(const OperatorProfile& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const OperatorProfile& default_instance(); + + void Swap(OperatorProfile* other); + + // implements Message ---------------------------------------------- + + OperatorProfile* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const OperatorProfile& from); + void MergeFrom(const OperatorProfile& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // repeated .exec.shared.StreamProfile input_profile = 1; + inline int input_profile_size() const; + inline void clear_input_profile(); + static const int kInputProfileFieldNumber = 1; + inline const ::exec::shared::StreamProfile& input_profile(int index) const; + inline ::exec::shared::StreamProfile* mutable_input_profile(int index); + inline ::exec::shared::StreamProfile* add_input_profile(); + inline const ::google::protobuf::RepeatedPtrField< ::exec::shared::StreamProfile >& + input_profile() const; + inline ::google::protobuf::RepeatedPtrField< ::exec::shared::StreamProfile >* + mutable_input_profile(); + + // optional int32 operator_id = 3; + inline bool has_operator_id() const; + inline void clear_operator_id(); + static const int kOperatorIdFieldNumber = 3; + inline ::google::protobuf::int32 operator_id() const; + inline void set_operator_id(::google::protobuf::int32 value); + + // optional int32 operator_type = 4; + inline bool has_operator_type() const; + inline void clear_operator_type(); + static const int kOperatorTypeFieldNumber = 4; + inline ::google::protobuf::int32 operator_type() const; + inline void set_operator_type(::google::protobuf::int32 value); + + // optional int64 setup_nanos = 5; + inline bool has_setup_nanos() const; + inline void clear_setup_nanos(); + static const int kSetupNanosFieldNumber = 5; + inline ::google::protobuf::int64 setup_nanos() const; + inline void set_setup_nanos(::google::protobuf::int64 value); + + // optional int64 process_nanos = 6; + inline bool has_process_nanos() const; + inline void clear_process_nanos(); + static const int kProcessNanosFieldNumber = 6; + inline ::google::protobuf::int64 process_nanos() const; + inline void set_process_nanos(::google::protobuf::int64 value); + + // optional int64 local_memory_allocated = 7; + inline bool has_local_memory_allocated() const; + inline void clear_local_memory_allocated(); + static const int kLocalMemoryAllocatedFieldNumber = 7; + inline ::google::protobuf::int64 local_memory_allocated() const; + inline void set_local_memory_allocated(::google::protobuf::int64 value); + + // repeated .exec.shared.MetricValue metric = 8; + inline int metric_size() const; + inline void clear_metric(); + static const int kMetricFieldNumber = 8; + inline const ::exec::shared::MetricValue& metric(int index) const; + inline ::exec::shared::MetricValue* mutable_metric(int index); + inline ::exec::shared::MetricValue* add_metric(); + inline const ::google::protobuf::RepeatedPtrField< ::exec::shared::MetricValue >& + metric() const; + inline ::google::protobuf::RepeatedPtrField< ::exec::shared::MetricValue >* + mutable_metric(); + + // @@protoc_insertion_point(class_scope:exec.shared.OperatorProfile) + private: + inline void set_has_operator_id(); + inline void clear_has_operator_id(); + inline void set_has_operator_type(); + inline void clear_has_operator_type(); + inline void set_has_setup_nanos(); + inline void clear_has_setup_nanos(); + inline void set_has_process_nanos(); + inline void clear_has_process_nanos(); + inline void set_has_local_memory_allocated(); + inline void clear_has_local_memory_allocated(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::RepeatedPtrField< ::exec::shared::StreamProfile > input_profile_; + ::google::protobuf::int32 operator_id_; + ::google::protobuf::int32 operator_type_; + ::google::protobuf::int64 setup_nanos_; + ::google::protobuf::int64 process_nanos_; + ::google::protobuf::int64 local_memory_allocated_; + ::google::protobuf::RepeatedPtrField< ::exec::shared::MetricValue > metric_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(7 + 31) / 32]; + + friend void protobuf_AddDesc_UserBitShared_2eproto(); + friend void protobuf_AssignDesc_UserBitShared_2eproto(); + friend void protobuf_ShutdownFile_UserBitShared_2eproto(); + + void InitAsDefaultInstance(); + static OperatorProfile* default_instance_; +}; +// ------------------------------------------------------------------- + +class StreamProfile : public ::google::protobuf::Message { + public: + StreamProfile(); + virtual ~StreamProfile(); + + StreamProfile(const StreamProfile& from); + + inline StreamProfile& operator=(const StreamProfile& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const StreamProfile& default_instance(); + + void Swap(StreamProfile* other); + + // implements Message ---------------------------------------------- + + StreamProfile* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const StreamProfile& from); + void MergeFrom(const StreamProfile& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional int64 records = 1; + inline bool has_records() const; + inline void clear_records(); + static const int kRecordsFieldNumber = 1; + inline ::google::protobuf::int64 records() const; + inline void set_records(::google::protobuf::int64 value); + + // optional int64 batches = 2; + inline bool has_batches() const; + inline void clear_batches(); + static const int kBatchesFieldNumber = 2; + inline ::google::protobuf::int64 batches() const; + inline void set_batches(::google::protobuf::int64 value); + + // optional int64 schemas = 3; + inline bool has_schemas() const; + inline void clear_schemas(); + static const int kSchemasFieldNumber = 3; + inline ::google::protobuf::int64 schemas() const; + inline void set_schemas(::google::protobuf::int64 value); + + // @@protoc_insertion_point(class_scope:exec.shared.StreamProfile) + private: + inline void set_has_records(); + inline void clear_has_records(); + inline void set_has_batches(); + inline void clear_has_batches(); + inline void set_has_schemas(); + inline void clear_has_schemas(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::int64 records_; + ::google::protobuf::int64 batches_; + ::google::protobuf::int64 schemas_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32]; + + friend void protobuf_AddDesc_UserBitShared_2eproto(); + friend void protobuf_AssignDesc_UserBitShared_2eproto(); + friend void protobuf_ShutdownFile_UserBitShared_2eproto(); + + void InitAsDefaultInstance(); + static StreamProfile* default_instance_; +}; +// ------------------------------------------------------------------- + +class MetricValue : public ::google::protobuf::Message { + public: + MetricValue(); + virtual ~MetricValue(); + + MetricValue(const MetricValue& from); + + inline MetricValue& operator=(const MetricValue& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const MetricValue& default_instance(); + + void Swap(MetricValue* other); + + // implements Message ---------------------------------------------- + + MetricValue* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const MetricValue& from); + void MergeFrom(const MetricValue& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional int32 metric_id = 1; + inline bool has_metric_id() const; + inline void clear_metric_id(); + static const int kMetricIdFieldNumber = 1; + inline ::google::protobuf::int32 metric_id() const; + inline void set_metric_id(::google::protobuf::int32 value); + + // optional int64 long_value = 2; + inline bool has_long_value() const; + inline void clear_long_value(); + static const int kLongValueFieldNumber = 2; + inline ::google::protobuf::int64 long_value() const; + inline void set_long_value(::google::protobuf::int64 value); + + // optional double double_value = 3; + inline bool has_double_value() const; + inline void clear_double_value(); + static const int kDoubleValueFieldNumber = 3; + inline double double_value() const; + inline void set_double_value(double value); + + // @@protoc_insertion_point(class_scope:exec.shared.MetricValue) + private: + inline void set_has_metric_id(); + inline void clear_has_metric_id(); + inline void set_has_long_value(); + inline void clear_has_long_value(); + inline void set_has_double_value(); + inline void clear_has_double_value(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::int64 long_value_; + double double_value_; + ::google::protobuf::int32 metric_id_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32]; + + friend void protobuf_AddDesc_UserBitShared_2eproto(); + friend void protobuf_AssignDesc_UserBitShared_2eproto(); + friend void protobuf_ShutdownFile_UserBitShared_2eproto(); + + void InitAsDefaultInstance(); + static MetricValue* default_instance_; +}; // =================================================================== @@ -1747,6 +2617,873 @@ inline void SerializedField::set_buffer_length(::google::protobuf::int32 value) buffer_length_ = value; } +// ------------------------------------------------------------------- + +// QueryProfile + +// optional .exec.shared.QueryId id = 1; +inline bool QueryProfile::has_id() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void QueryProfile::set_has_id() { + _has_bits_[0] |= 0x00000001u; +} +inline void QueryProfile::clear_has_id() { + _has_bits_[0] &= ~0x00000001u; +} +inline void QueryProfile::clear_id() { + if (id_ != NULL) id_->::exec::shared::QueryId::Clear(); + clear_has_id(); +} +inline const ::exec::shared::QueryId& QueryProfile::id() const { + return id_ != NULL ? *id_ : *default_instance_->id_; +} +inline ::exec::shared::QueryId* QueryProfile::mutable_id() { + set_has_id(); + if (id_ == NULL) id_ = new ::exec::shared::QueryId; + return id_; +} +inline ::exec::shared::QueryId* QueryProfile::release_id() { + clear_has_id(); + ::exec::shared::QueryId* temp = id_; + id_ = NULL; + return temp; +} +inline void QueryProfile::set_allocated_id(::exec::shared::QueryId* id) { + delete id_; + id_ = id; + if (id) { + set_has_id(); + } else { + clear_has_id(); + } +} + +// optional .exec.shared.QueryType type = 2; +inline bool QueryProfile::has_type() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void QueryProfile::set_has_type() { + _has_bits_[0] |= 0x00000002u; +} +inline void QueryProfile::clear_has_type() { + _has_bits_[0] &= ~0x00000002u; +} +inline void QueryProfile::clear_type() { + type_ = 1; + clear_has_type(); +} +inline ::exec::shared::QueryType QueryProfile::type() const { + return static_cast< ::exec::shared::QueryType >(type_); +} +inline void QueryProfile::set_type(::exec::shared::QueryType value) { + assert(::exec::shared::QueryType_IsValid(value)); + set_has_type(); + type_ = value; +} + +// optional int64 start = 3; +inline bool QueryProfile::has_start() const { + return (_has_bits_[0] & 0x00000004u) != 0; +} +inline void QueryProfile::set_has_start() { + _has_bits_[0] |= 0x00000004u; +} +inline void QueryProfile::clear_has_start() { + _has_bits_[0] &= ~0x00000004u; +} +inline void QueryProfile::clear_start() { + start_ = GOOGLE_LONGLONG(0); + clear_has_start(); +} +inline ::google::protobuf::int64 QueryProfile::start() const { + return start_; +} +inline void QueryProfile::set_start(::google::protobuf::int64 value) { + set_has_start(); + start_ = value; +} + +// optional int64 end = 4; +inline bool QueryProfile::has_end() const { + return (_has_bits_[0] & 0x00000008u) != 0; +} +inline void QueryProfile::set_has_end() { + _has_bits_[0] |= 0x00000008u; +} +inline void QueryProfile::clear_has_end() { + _has_bits_[0] &= ~0x00000008u; +} +inline void QueryProfile::clear_end() { + end_ = GOOGLE_LONGLONG(0); + clear_has_end(); +} +inline ::google::protobuf::int64 QueryProfile::end() const { + return end_; +} +inline void QueryProfile::set_end(::google::protobuf::int64 value) { + set_has_end(); + end_ = value; +} + +// optional string query = 5; +inline bool QueryProfile::has_query() const { + return (_has_bits_[0] & 0x00000010u) != 0; +} +inline void QueryProfile::set_has_query() { + _has_bits_[0] |= 0x00000010u; +} +inline void QueryProfile::clear_has_query() { + _has_bits_[0] &= ~0x00000010u; +} +inline void QueryProfile::clear_query() { + if (query_ != &::google::protobuf::internal::kEmptyString) { + query_->clear(); + } + clear_has_query(); +} +inline const ::std::string& QueryProfile::query() const { + return *query_; +} +inline void QueryProfile::set_query(const ::std::string& value) { + set_has_query(); + if (query_ == &::google::protobuf::internal::kEmptyString) { + query_ = new ::std::string; + } + query_->assign(value); +} +inline void QueryProfile::set_query(const char* value) { + set_has_query(); + if (query_ == &::google::protobuf::internal::kEmptyString) { + query_ = new ::std::string; + } + query_->assign(value); +} +inline void QueryProfile::set_query(const char* value, size_t size) { + set_has_query(); + if (query_ == &::google::protobuf::internal::kEmptyString) { + query_ = new ::std::string; + } + query_->assign(reinterpret_cast<const char*>(value), size); +} +inline ::std::string* QueryProfile::mutable_query() { + set_has_query(); + if (query_ == &::google::protobuf::internal::kEmptyString) { + query_ = new ::std::string; + } + return query_; +} +inline ::std::string* QueryProfile::release_query() { + clear_has_query(); + if (query_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = query_; + query_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} +inline void QueryProfile::set_allocated_query(::std::string* query) { + if (query_ != &::google::protobuf::internal::kEmptyString) { + delete query_; + } + if (query) { + set_has_query(); + query_ = query; + } else { + clear_has_query(); + query_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + } +} + +// optional string plan = 6; +inline bool QueryProfile::has_plan() const { + return (_has_bits_[0] & 0x00000020u) != 0; +} +inline void QueryProfile::set_has_plan() { + _has_bits_[0] |= 0x00000020u; +} +inline void QueryProfile::clear_has_plan() { + _has_bits_[0] &= ~0x00000020u; +} +inline void QueryProfile::clear_plan() { + if (plan_ != &::google::protobuf::internal::kEmptyString) { + plan_->clear(); + } + clear_has_plan(); +} +inline const ::std::string& QueryProfile::plan() const { + return *plan_; +} +inline void QueryProfile::set_plan(const ::std::string& value) { + set_has_plan(); + if (plan_ == &::google::protobuf::internal::kEmptyString) { + plan_ = new ::std::string; + } + plan_->assign(value); +} +inline void QueryProfile::set_plan(const char* value) { + set_has_plan(); + if (plan_ == &::google::protobuf::internal::kEmptyString) { + plan_ = new ::std::string; + } + plan_->assign(value); +} +inline void QueryProfile::set_plan(const char* value, size_t size) { + set_has_plan(); + if (plan_ == &::google::protobuf::internal::kEmptyString) { + plan_ = new ::std::string; + } + plan_->assign(reinterpret_cast<const char*>(value), size); +} +inline ::std::string* QueryProfile::mutable_plan() { + set_has_plan(); + if (plan_ == &::google::protobuf::internal::kEmptyString) { + plan_ = new ::std::string; + } + return plan_; +} +inline ::std::string* QueryProfile::release_plan() { + clear_has_plan(); + if (plan_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = plan_; + plan_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} +inline void QueryProfile::set_allocated_plan(::std::string* plan) { + if (plan_ != &::google::protobuf::internal::kEmptyString) { + delete plan_; + } + if (plan) { + set_has_plan(); + plan_ = plan; + } else { + clear_has_plan(); + plan_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + } +} + +// repeated .exec.shared.MajorFragmentProfile fragment_profile = 7; +inline int QueryProfile::fragment_profile_size() const { + return fragment_profile_.size(); +} +inline void QueryProfile::clear_fragment_profile() { + fragment_profile_.Clear(); +} +inline const ::exec::shared::MajorFragmentProfile& QueryProfile::fragment_profile(int index) const { + return fragment_profile_.Get(index); +} +inline ::exec::shared::MajorFragmentProfile* QueryProfile::mutable_fragment_profile(int index) { + return fragment_profile_.Mutable(index); +} +inline ::exec::shared::MajorFragmentProfile* QueryProfile::add_fragment_profile() { + return fragment_profile_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::exec::shared::MajorFragmentProfile >& +QueryProfile::fragment_profile() const { + return fragment_profile_; +} +inline ::google::protobuf::RepeatedPtrField< ::exec::shared::MajorFragmentProfile >* +QueryProfile::mutable_fragment_profile() { + return &fragment_profile_; +} + +// ------------------------------------------------------------------- + +// MajorFragmentProfile + +// optional int32 major_fragment_id = 1; +inline bool MajorFragmentProfile::has_major_fragment_id() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void MajorFragmentProfile::set_has_major_fragment_id() { + _has_bits_[0] |= 0x00000001u; +} +inline void MajorFragmentProfile::clear_has_major_fragment_id() { + _has_bits_[0] &= ~0x00000001u; +} +inline void MajorFragmentProfile::clear_major_fragment_id() { + major_fragment_id_ = 0; + clear_has_major_fragment_id(); +} +inline ::google::protobuf::int32 MajorFragmentProfile::major_fragment_id() const { + return major_fragment_id_; +} +inline void MajorFragmentProfile::set_major_fragment_id(::google::protobuf::int32 value) { + set_has_major_fragment_id(); + major_fragment_id_ = value; +} + +// repeated .exec.shared.MinorFragmentProfile minor_fragment_profile = 2; +inline int MajorFragmentProfile::minor_fragment_profile_size() const { + return minor_fragment_profile_.size(); +} +inline void MajorFragmentProfile::clear_minor_fragment_profile() { + minor_fragment_profile_.Clear(); +} +inline const ::exec::shared::MinorFragmentProfile& MajorFragmentProfile::minor_fragment_profile(int index) const { + return minor_fragment_profile_.Get(index); +} +inline ::exec::shared::MinorFragmentProfile* MajorFragmentProfile::mutable_minor_fragment_profile(int index) { + return minor_fragment_profile_.Mutable(index); +} +inline ::exec::shared::MinorFragmentProfile* MajorFragmentProfile::add_minor_fragment_profile() { + return minor_fragment_profile_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::exec::shared::MinorFragmentProfile >& +MajorFragmentProfile::minor_fragment_profile() const { + return minor_fragment_profile_; +} +inline ::google::protobuf::RepeatedPtrField< ::exec::shared::MinorFragmentProfile >* +MajorFragmentProfile::mutable_minor_fragment_profile() { + return &minor_fragment_profile_; +} + +// ------------------------------------------------------------------- + +// MinorFragmentProfile + +// optional .exec.shared.FragmentState state = 1; +inline bool MinorFragmentProfile::has_state() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void MinorFragmentProfile::set_has_state() { + _has_bits_[0] |= 0x00000001u; +} +inline void MinorFragmentProfile::clear_has_state() { + _has_bits_[0] &= ~0x00000001u; +} +inline void MinorFragmentProfile::clear_state() { + state_ = 0; + clear_has_state(); +} +inline ::exec::shared::FragmentState MinorFragmentProfile::state() const { + return static_cast< ::exec::shared::FragmentState >(state_); +} +inline void MinorFragmentProfile::set_state(::exec::shared::FragmentState value) { + assert(::exec::shared::FragmentState_IsValid(value)); + set_has_state(); + state_ = value; +} + +// optional .exec.shared.DrillPBError error = 2; +inline bool MinorFragmentProfile::has_error() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void MinorFragmentProfile::set_has_error() { + _has_bits_[0] |= 0x00000002u; +} +inline void MinorFragmentProfile::clear_has_error() { + _has_bits_[0] &= ~0x00000002u; +} +inline void MinorFragmentProfile::clear_error() { + if (error_ != NULL) error_->::exec::shared::DrillPBError::Clear(); + clear_has_error(); +} +inline const ::exec::shared::DrillPBError& MinorFragmentProfile::error() const { + return error_ != NULL ? *error_ : *default_instance_->error_; +} +inline ::exec::shared::DrillPBError* MinorFragmentProfile::mutable_error() { + set_has_error(); + if (error_ == NULL) error_ = new ::exec::shared::DrillPBError; + return error_; +} +inline ::exec::shared::DrillPBError* MinorFragmentProfile::release_error() { + clear_has_error(); + ::exec::shared::DrillPBError* temp = error_; + error_ = NULL; + return temp; +} +inline void MinorFragmentProfile::set_allocated_error(::exec::shared::DrillPBError* error) { + delete error_; + error_ = error; + if (error) { + set_has_error(); + } else { + clear_has_error(); + } +} + +// optional int32 minor_fragment_id = 3; +inline bool MinorFragmentProfile::has_minor_fragment_id() const { + return (_has_bits_[0] & 0x00000004u) != 0; +} +inline void MinorFragmentProfile::set_has_minor_fragment_id() { + _has_bits_[0] |= 0x00000004u; +} +inline void MinorFragmentProfile::clear_has_minor_fragment_id() { + _has_bits_[0] &= ~0x00000004u; +} +inline void MinorFragmentProfile::clear_minor_fragment_id() { + minor_fragment_id_ = 0; + clear_has_minor_fragment_id(); +} +inline ::google::protobuf::int32 MinorFragmentProfile::minor_fragment_id() const { + return minor_fragment_id_; +} +inline void MinorFragmentProfile::set_minor_fragment_id(::google::protobuf::int32 value) { + set_has_minor_fragment_id(); + minor_fragment_id_ = value; +} + +// repeated .exec.shared.OperatorProfile operator_profile = 4; +inline int MinorFragmentProfile::operator_profile_size() const { + return operator_profile_.size(); +} +inline void MinorFragmentProfile::clear_operator_profile() { + operator_profile_.Clear(); +} +inline const ::exec::shared::OperatorProfile& MinorFragmentProfile::operator_profile(int index) const { + return operator_profile_.Get(index); +} +inline ::exec::shared::OperatorProfile* MinorFragmentProfile::mutable_operator_profile(int index) { + return operator_profile_.Mutable(index); +} +inline ::exec::shared::OperatorProfile* MinorFragmentProfile::add_operator_profile() { + return operator_profile_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::exec::shared::OperatorProfile >& +MinorFragmentProfile::operator_profile() const { + return operator_profile_; +} +inline ::google::protobuf::RepeatedPtrField< ::exec::shared::OperatorProfile >* +MinorFragmentProfile::mutable_operator_profile() { + return &operator_profile_; +} + +// optional int64 start_time = 5; +inline bool MinorFragmentProfile::has_start_time() const { + return (_has_bits_[0] & 0x00000010u) != 0; +} +inline void MinorFragmentProfile::set_has_start_time() { + _has_bits_[0] |= 0x00000010u; +} +inline void MinorFragmentProfile::clear_has_start_time() { + _has_bits_[0] &= ~0x00000010u; +} +inline void MinorFragmentProfile::clear_start_time() { + start_time_ = GOOGLE_LONGLONG(0); + clear_has_start_time(); +} +inline ::google::protobuf::int64 MinorFragmentProfile::start_time() const { + return start_time_; +} +inline void MinorFragmentProfile::set_start_time(::google::protobuf::int64 value) { + set_has_start_time(); + start_time_ = value; +} + +// optional int64 end_time = 6; +inline bool MinorFragmentProfile::has_end_time() const { + return (_has_bits_[0] & 0x00000020u) != 0; +} +inline void MinorFragmentProfile::set_has_end_time() { + _has_bits_[0] |= 0x00000020u; +} +inline void MinorFragmentProfile::clear_has_end_time() { + _has_bits_[0] &= ~0x00000020u; +} +inline void MinorFragmentProfile::clear_end_time() { + end_time_ = GOOGLE_LONGLONG(0); + clear_has_end_time(); +} +inline ::google::protobuf::int64 MinorFragmentProfile::end_time() const { + return end_time_; +} +inline void MinorFragmentProfile::set_end_time(::google::protobuf::int64 value) { + set_has_end_time(); + end_time_ = value; +} + +// optional int64 memory_used = 7; +inline bool MinorFragmentProfile::has_memory_used() const { + return (_has_bits_[0] & 0x00000040u) != 0; +} +inline void MinorFragmentProfile::set_has_memory_used() { + _has_bits_[0] |= 0x00000040u; +} +inline void MinorFragmentProfile::clear_has_memory_used() { + _has_bits_[0] &= ~0x00000040u; +} +inline void MinorFragmentProfile::clear_memory_used() { + memory_used_ = GOOGLE_LONGLONG(0); + clear_has_memory_used(); +} +inline ::google::protobuf::int64 MinorFragmentProfile::memory_used() const { + return memory_used_; +} +inline void MinorFragmentProfile::set_memory_used(::google::protobuf::int64 value) { + set_has_memory_used(); + memory_used_ = value; +} + +// optional int64 max_memory_used = 8; +inline bool MinorFragmentProfile::has_max_memory_used() const { + return (_has_bits_[0] & 0x00000080u) != 0; +} +inline void MinorFragmentProfile::set_has_max_memory_used() { + _has_bits_[0] |= 0x00000080u; +} +inline void MinorFragmentProfile::clear_has_max_memory_used() { + _has_bits_[0] &= ~0x00000080u; +} +inline void MinorFragmentProfile::clear_max_memory_used() { + max_memory_used_ = GOOGLE_LONGLONG(0); + clear_has_max_memory_used(); +} +inline ::google::protobuf::int64 MinorFragmentProfile::max_memory_used() const { + return max_memory_used_; +} +inline void MinorFragmentProfile::set_max_memory_used(::google::protobuf::int64 value) { + set_has_max_memory_used(); + max_memory_used_ = value; +} + +// optional .exec.DrillbitEndpoint endpoint = 9; +inline bool MinorFragmentProfile::has_endpoint() const { + return (_has_bits_[0] & 0x00000100u) != 0; +} +inline void MinorFragmentProfile::set_has_endpoint() { + _has_bits_[0] |= 0x00000100u; +} +inline void MinorFragmentProfile::clear_has_endpoint() { + _has_bits_[0] &= ~0x00000100u; +} +inline void MinorFragmentProfile::clear_endpoint() { + if (endpoint_ != NULL) endpoint_->::exec::DrillbitEndpoint::Clear(); + clear_has_endpoint(); +} +inline const ::exec::DrillbitEndpoint& MinorFragmentProfile::endpoint() const { + return endpoint_ != NULL ? *endpoint_ : *default_instance_->endpoint_; +} +inline ::exec::DrillbitEndpoint* MinorFragmentProfile::mutable_endpoint() { + set_has_endpoint(); + if (endpoint_ == NULL) endpoint_ = new ::exec::DrillbitEndpoint; + return endpoint_; +} +inline ::exec::DrillbitEndpoint* MinorFragmentProfile::release_endpoint() { + clear_has_endpoint(); + ::exec::DrillbitEndpoint* temp = endpoint_; + endpoint_ = NULL; + return temp; +} +inline void MinorFragmentProfile::set_allocated_endpoint(::exec::DrillbitEndpoint* endpoint) { + delete endpoint_; + endpoint_ = endpoint; + if (endpoint) { + set_has_endpoint(); + } else { + clear_has_endpoint(); + } +} + +// ------------------------------------------------------------------- + +// OperatorProfile + +// repeated .exec.shared.StreamProfile input_profile = 1; +inline int OperatorProfile::input_profile_size() const { + return input_profile_.size(); +} +inline void OperatorProfile::clear_input_profile() { + input_profile_.Clear(); +} +inline const ::exec::shared::StreamProfile& OperatorProfile::input_profile(int index) const { + return input_profile_.Get(index); +} +inline ::exec::shared::StreamProfile* OperatorProfile::mutable_input_profile(int index) { + return input_profile_.Mutable(index); +} +inline ::exec::shared::StreamProfile* OperatorProfile::add_input_profile() { + return input_profile_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::exec::shared::StreamProfile >& +OperatorProfile::input_profile() const { + return input_profile_; +} +inline ::google::protobuf::RepeatedPtrField< ::exec::shared::StreamProfile >* +OperatorProfile::mutable_input_profile() { + return &input_profile_; +} + +// optional int32 operator_id = 3; +inline bool OperatorProfile::has_operator_id() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void OperatorProfile::set_has_operator_id() { + _has_bits_[0] |= 0x00000002u; +} +inline void OperatorProfile::clear_has_operator_id() { + _has_bits_[0] &= ~0x00000002u; +} +inline void OperatorProfile::clear_operator_id() { + operator_id_ = 0; + clear_has_operator_id(); +} +inline ::google::protobuf::int32 OperatorProfile::operator_id() const { + return operator_id_; +} +inline void OperatorProfile::set_operator_id(::google::protobuf::int32 value) { + set_has_operator_id(); + operator_id_ = value; +} + +// optional int32 operator_type = 4; +inline bool OperatorProfile::has_operator_type() const { + return (_has_bits_[0] & 0x00000004u) != 0; +} +inline void OperatorProfile::set_has_operator_type() { + _has_bits_[0] |= 0x00000004u; +} +inline void OperatorProfile::clear_has_operator_type() { + _has_bits_[0] &= ~0x00000004u; +} +inline void OperatorProfile::clear_operator_type() { + operator_type_ = 0; + clear_has_operator_type(); +} +inline ::google::protobuf::int32 OperatorProfile::operator_type() const { + return operator_type_; +} +inline void OperatorProfile::set_operator_type(::google::protobuf::int32 value) { + set_has_operator_type(); + operator_type_ = value; +} + +// optional int64 setup_nanos = 5; +inline bool OperatorProfile::has_setup_nanos() const { + return (_has_bits_[0] & 0x00000008u) != 0; +} +inline void OperatorProfile::set_has_setup_nanos() { + _has_bits_[0] |= 0x00000008u; +} +inline void OperatorProfile::clear_has_setup_nanos() { + _has_bits_[0] &= ~0x00000008u; +} +inline void OperatorProfile::clear_setup_nanos() { + setup_nanos_ = GOOGLE_LONGLONG(0); + clear_has_setup_nanos(); +} +inline ::google::protobuf::int64 OperatorProfile::setup_nanos() const { + return setup_nanos_; +} +inline void OperatorProfile::set_setup_nanos(::google::protobuf::int64 value) { + set_has_setup_nanos(); + setup_nanos_ = value; +} + +// optional int64 process_nanos = 6; +inline bool OperatorProfile::has_process_nanos() const { + return (_has_bits_[0] & 0x00000010u) != 0; +} +inline void OperatorProfile::set_has_process_nanos() { + _has_bits_[0] |= 0x00000010u; +} +inline void OperatorProfile::clear_has_process_nanos() { + _has_bits_[0] &= ~0x00000010u; +} +inline void OperatorProfile::clear_process_nanos() { + process_nanos_ = GOOGLE_LONGLONG(0); + clear_has_process_nanos(); +} +inline ::google::protobuf::int64 OperatorProfile::process_nanos() const { + return process_nanos_; +} +inline void OperatorProfile::set_process_nanos(::google::protobuf::int64 value) { + set_has_process_nanos(); + process_nanos_ = value; +} + +// optional int64 local_memory_allocated = 7; +inline bool OperatorProfile::has_local_memory_allocated() const { + return (_has_bits_[0] & 0x00000020u) != 0; +} +inline void OperatorProfile::set_has_local_memory_allocated() { + _has_bits_[0] |= 0x00000020u; +} +inline void OperatorProfile::clear_has_local_memory_allocated() { + _has_bits_[0] &= ~0x00000020u; +} +inline void OperatorProfile::clear_local_memory_allocated() { + local_memory_allocated_ = GOOGLE_LONGLONG(0); + clear_has_local_memory_allocated(); +} +inline ::google::protobuf::int64 OperatorProfile::local_memory_allocated() const { + return local_memory_allocated_; +} +inline void OperatorProfile::set_local_memory_allocated(::google::protobuf::int64 value) { + set_has_local_memory_allocated(); + local_memory_allocated_ = value; +} + +// repeated .exec.shared.MetricValue metric = 8; +inline int OperatorProfile::metric_size() const { + return metric_.size(); +} +inline void OperatorProfile::clear_metric() { + metric_.Clear(); +} +inline const ::exec::shared::MetricValue& OperatorProfile::metric(int index) const { + return metric_.Get(index); +} +inline ::exec::shared::MetricValue* OperatorProfile::mutable_metric(int index) { + return metric_.Mutable(index); +} +inline ::exec::shared::MetricValue* OperatorProfile::add_metric() { + return metric_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::exec::shared::MetricValue >& +OperatorProfile::metric() const { + return metric_; +} +inline ::google::protobuf::RepeatedPtrField< ::exec::shared::MetricValue >* +OperatorProfile::mutable_metric() { + return &metric_; +} + +// ------------------------------------------------------------------- + +// StreamProfile + +// optional int64 records = 1; +inline bool StreamProfile::has_records() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void StreamProfile::set_has_records() { + _has_bits_[0] |= 0x00000001u; +} +inline void StreamProfile::clear_has_records() { + _has_bits_[0] &= ~0x00000001u; +} +inline void StreamProfile::clear_records() { + records_ = GOOGLE_LONGLONG(0); + clear_has_records(); +} +inline ::google::protobuf::int64 StreamProfile::records() const { + return records_; +} +inline void StreamProfile::set_records(::google::protobuf::int64 value) { + set_has_records(); + records_ = value; +} + +// optional int64 batches = 2; +inline bool StreamProfile::has_batches() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void StreamProfile::set_has_batches() { + _has_bits_[0] |= 0x00000002u; +} +inline void StreamProfile::clear_has_batches() { + _has_bits_[0] &= ~0x00000002u; +} +inline void StreamProfile::clear_batches() { + batches_ = GOOGLE_LONGLONG(0); + clear_has_batches(); +} +inline ::google::protobuf::int64 StreamProfile::batches() const { + return batches_; +} +inline void StreamProfile::set_batches(::google::protobuf::int64 value) { + set_has_batches(); + batches_ = value; +} + +// optional int64 schemas = 3; +inline bool StreamProfile::has_schemas() const { + return (_has_bits_[0] & 0x00000004u) != 0; +} +inline void StreamProfile::set_has_schemas() { + _has_bits_[0] |= 0x00000004u; +} +inline void StreamProfile::clear_has_schemas() { + _has_bits_[0] &= ~0x00000004u; +} +inline void StreamProfile::clear_schemas() { + schemas_ = GOOGLE_LONGLONG(0); + clear_has_schemas(); +} +inline ::google::protobuf::int64 StreamProfile::schemas() const { + return schemas_; +} +inline void StreamProfile::set_schemas(::google::protobuf::int64 value) { + set_has_schemas(); + schemas_ = value; +} + +// ------------------------------------------------------------------- + +// MetricValue + +// optional int32 metric_id = 1; +inline bool MetricValue::has_metric_id() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void MetricValue::set_has_metric_id() { + _has_bits_[0] |= 0x00000001u; +} +inline void MetricValue::clear_has_metric_id() { + _has_bits_[0] &= ~0x00000001u; +} +inline void MetricValue::clear_metric_id() { + metric_id_ = 0; + clear_has_metric_id(); +} +inline ::google::protobuf::int32 MetricValue::metric_id() const { + return metric_id_; +} +inline void MetricValue::set_metric_id(::google::protobuf::int32 value) { + set_has_metric_id(); + metric_id_ = value; +} + +// optional int64 long_value = 2; +inline bool MetricValue::has_long_value() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void MetricValue::set_has_long_value() { + _has_bits_[0] |= 0x00000002u; +} +inline void MetricValue::clear_has_long_value() { + _has_bits_[0] &= ~0x00000002u; +} +inline void MetricValue::clear_long_value() { + long_value_ = GOOGLE_LONGLONG(0); + clear_has_long_value(); +} +inline ::google::protobuf::int64 MetricValue::long_value() const { + return long_value_; +} +inline void MetricValue::set_long_value(::google::protobuf::int64 value) { + set_has_long_value(); + long_value_ = value; +} + +// optional double double_value = 3; +inline bool MetricValue::has_double_value() const { + return (_has_bits_[0] & 0x00000004u) != 0; +} +inline void MetricValue::set_has_double_value() { + _has_bits_[0] |= 0x00000004u; +} +inline void MetricValue::clear_has_double_value() { + _has_bits_[0] &= ~0x00000004u; +} +inline void MetricValue::clear_double_value() { + double_value_ = 0; + clear_has_double_value(); +} +inline double MetricValue::double_value() const { + return double_value_; +} +inline void MetricValue::set_double_value(double value) { + set_has_double_value(); + double_value_ = value; +} + // @@protoc_insertion_point(namespace_scope) @@ -1765,6 +3502,18 @@ template <> inline const EnumDescriptor* GetEnumDescriptor< ::exec::shared::RpcChannel>() { return ::exec::shared::RpcChannel_descriptor(); } +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::exec::shared::QueryType>() { + return ::exec::shared::QueryType_descriptor(); +} +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::exec::shared::FragmentState>() { + return ::exec::shared::FragmentState_descriptor(); +} +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::exec::shared::CoreOperatorType>() { + return ::exec::shared::CoreOperatorType_descriptor(); +} } // namespace google } // namespace protobuf |