diff --git a/native-sql-engine/cpp/src/precompile/hash_map.cc b/native-sql-engine/cpp/src/precompile/hash_map.cc index 4b22bf09c..3f3b89774 100644 --- a/native-sql-engine/cpp/src/precompile/hash_map.cc +++ b/native-sql-engine/cpp/src/precompile/hash_map.cc @@ -53,7 +53,7 @@ namespace precompile { typename arrow::internal::HashTraits::MemoTableType; \ class HASHMAPNAME::Impl : public MEMOTABLETYPE { \ public: \ - Impl(arrow::MemoryPool* pool) : MEMOTABLETYPE(pool) {} \ + Impl(arrow::MemoryPool* pool) : MEMOTABLETYPE(pool, 128) {} \ }; \ \ HASHMAPNAME::HASHMAPNAME(arrow::MemoryPool* pool) { \ @@ -107,6 +107,6 @@ TYPED_ARROW_HASH_MAP_IMPL(StringHashMap, StringType, arrow::util::string_view, TYPED_ARROW_HASH_MAP_DECIMAL_IMPL(Decimal128HashMap, Decimal128Type, arrow::Decimal128, DecimalMemoTableType) #undef TYPED_ARROW_HASH_MAP_IMPL - +#undef TYPED_ARROW_HASH_MAP_DECIMAL_IMPL } // namespace precompile } // namespace sparkcolumnarplugin diff --git a/native-sql-engine/cpp/src/precompile/unsafe_array.h b/native-sql-engine/cpp/src/precompile/unsafe_array.h index 05b585854..42b0c2fe3 100644 --- a/native-sql-engine/cpp/src/precompile/unsafe_array.h +++ b/native-sql-engine/cpp/src/precompile/unsafe_array.h @@ -89,7 +89,7 @@ class TypedUnsafeArray> : public Unsaf if (!skip_null_check_ && typed_array_->IsNull(i)) { setNullAt((*unsafe_row).get(), idx_); } else { - auto v = typed_array_->GetString(i); + auto v = typed_array_->GetView(i); appendToUnsafeRow((*unsafe_row).get(), idx_, v); } return arrow::Status::OK(); diff --git a/native-sql-engine/cpp/src/third_party/row_wise_memory/unsafe_row.h b/native-sql-engine/cpp/src/third_party/row_wise_memory/unsafe_row.h index 5eb137b4b..33f9ce473 100644 --- a/native-sql-engine/cpp/src/third_party/row_wise_memory/unsafe_row.h +++ b/native-sql-engine/cpp/src/third_party/row_wise_memory/unsafe_row.h @@ -118,7 +118,17 @@ static inline void appendToUnsafeRow(UnsafeRow* row, const int& index, // move the cursor forward. row->cursor += numBytes; } +static inline void appendToUnsafeRow(UnsafeRow* row, const int& index, + arrow::util::string_view str) { + int numBytes = str.size(); + // int roundedSize = roundNumberOfBytesToNearestWord(numBytes); + + // zeroOutPaddingBytes(row, numBytes); + memcpy(row->data + row->cursor, str.data(), numBytes); + // move the cursor forward. + row->cursor += numBytes; +} static inline void appendToUnsafeRow(UnsafeRow* row, const int& index, const arrow::Decimal128& dcm) { int numBytes = 16;