From cc25504d1bfeb7ac7bc99a6c3ce5285d30e13697 Mon Sep 17 00:00:00 2001 From: Parth Chandra Date: Wed, 27 Aug 2014 18:07:35 -0700 Subject: DRILL-1352: C++ Client. Update the decoding of nullable value vectors to read a byte for every nullable bit. --- contrib/native/client/src/include/drill/common.hpp | 2 +- contrib/native/client/src/include/drill/protobuf/Types.pb.h | 5 +++-- contrib/native/client/src/include/drill/recordBatch.hpp | 10 +++++----- 3 files changed, 9 insertions(+), 8 deletions(-) (limited to 'contrib/native/client/src/include') diff --git a/contrib/native/client/src/include/drill/common.hpp b/contrib/native/client/src/include/drill/common.hpp index dfb04e83f..151d698b5 100644 --- a/contrib/native/client/src/include/drill/common.hpp +++ b/contrib/native/client/src/include/drill/common.hpp @@ -33,7 +33,7 @@ #include #include -#define DRILL_RPC_VERSION 1 +#define DRILL_RPC_VERSION 2 #define LENGTH_PREFIX_MAX_LENGTH 5 #define LEN_PREFIX_BUFLEN LENGTH_PREFIX_MAX_LENGTH diff --git a/contrib/native/client/src/include/drill/protobuf/Types.pb.h b/contrib/native/client/src/include/drill/protobuf/Types.pb.h index 853415317..b26177c44 100644 --- a/contrib/native/client/src/include/drill/protobuf/Types.pb.h +++ b/contrib/native/client/src/include/drill/protobuf/Types.pb.h @@ -72,11 +72,12 @@ enum MinorType { DM_UNKNOWN = 37, INTERVALYEAR = 38, INTERVALDAY = 39, - LIST = 40 + LIST = 40, + GENERIC_OBJECT = 41 }; bool MinorType_IsValid(int value); const MinorType MinorType_MIN = LATE; -const MinorType MinorType_MAX = LIST; +const MinorType MinorType_MAX = GENERIC_OBJECT; const int MinorType_ARRAYSIZE = MinorType_MAX + 1; const ::google::protobuf::EnumDescriptor* MinorType_descriptor(); diff --git a/contrib/native/client/src/include/drill/recordBatch.hpp b/contrib/native/client/src/include/drill/recordBatch.hpp index 9a3df2b6f..61db88c8c 100644 --- a/contrib/native/client/src/include/drill/recordBatch.hpp +++ b/contrib/native/client/src/include/drill/recordBatch.hpp @@ -386,7 +386,7 @@ template { public: NullableValueVectorFixed(SlicedByteBuf *b, size_t rowCount):ValueVectorBase(b, rowCount){ - size_t offsetEnd = (size_t)ceil(rowCount/8.0); + size_t offsetEnd = (size_t)rowCount; this->m_pBitmap= new SlicedByteBuf(*b, 0, offsetEnd); this->m_pData= new SlicedByteBuf(*b, offsetEnd, b->getLength()); // TODO: testing boundary case(null columns) @@ -399,7 +399,7 @@ template // test whether the value is null in the position index bool isNull(size_t index) const { - return (m_pBitmap->getBit(index)==0); + return (m_pBitmap->getByte(index)==0); } VALUE_TYPE get(size_t index) const { @@ -584,14 +584,14 @@ template public: NullableValueVectorTyped(SlicedByteBuf *b, size_t rowCount):ValueVectorBase(b, rowCount){ - size_t offsetEnd = (size_t)ceil(rowCount/8.0); + size_t offsetEnd = (size_t)rowCount; 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); } // Specialized for Decimal Types NullableValueVectorTyped(SlicedByteBuf *b, size_t rowCount, int32_t scale):ValueVectorBase(b, rowCount){ - size_t offsetEnd = (size_t)ceil(rowCount/8.0); + size_t offsetEnd = (size_t)rowCount; 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, scale); @@ -604,7 +604,7 @@ template } bool isNull(size_t index) const{ - return (m_pBitmap->getBit(index)==0); + return (m_pBitmap->getByte(index)==0); } VALUEHOLDER_CLASS_TYPE get(size_t index) const { -- cgit v1.2.3