diff --git a/native-sql-engine/cpp/src/codegen/arrow_compute/ext/window_kernel.cc b/native-sql-engine/cpp/src/codegen/arrow_compute/ext/window_kernel.cc index 028778a72..39a380d24 100644 --- a/native-sql-engine/cpp/src/codegen/arrow_compute/ext/window_kernel.cc +++ b/native-sql-engine/cpp/src/codegen/arrow_compute/ext/window_kernel.cc @@ -482,7 +482,7 @@ static arrow::Status EncodeIndices(std::vector> std::shared_ptr* out) { arrow::UInt64Builder builder; for (const auto& each : in) { - uint64_t encoded = ((uint64_t)(each->array_id) << 16U) ^ ((uint64_t)(each->id)); + uint64_t encoded = ((uint64_t)(each->array_id) << 32U) ^ ((uint64_t)(each->id)); RETURN_NOT_OK(builder.Append(encoded)); } RETURN_NOT_OK(builder.Finish(out)); @@ -496,7 +496,7 @@ static arrow::Status DecodeIndices(std::shared_ptr in, std::dynamic_pointer_cast(in); for (int i = 0; i < selected->length(); i++) { uint64_t encoded = selected->GetView(i); - uint16_t array_id = (encoded & 0xFFFF0000U) >> 16U; + uint16_t array_id = (encoded & 0xFFFF0000U) >> 32U; uint16_t id = encoded & 0xFFFFU; v.push_back(std::make_shared(array_id, id)); } diff --git a/native-sql-engine/cpp/src/codegen/arrow_compute/ext/window_sort_kernel.h b/native-sql-engine/cpp/src/codegen/arrow_compute/ext/window_sort_kernel.h index 63b635525..ffc6b83a2 100644 --- a/native-sql-engine/cpp/src/codegen/arrow_compute/ext/window_sort_kernel.h +++ b/native-sql-engine/cpp/src/codegen/arrow_compute/ext/window_sort_kernel.h @@ -253,7 +253,7 @@ class TypedSorterImpl : public CodeGenBase { for (int i = 0; i < selected->length(); i++) { uint64_t encoded = selected->GetView(i); - uint16_t array_id = (encoded & 0xFFFF0000U) >> 16U; + uint16_t array_id = (encoded & 0xFFFF0000U) >> 32U; uint16_t id = encoded & 0xFFFFU; (indices_begin + indices_i)->array_id = array_id; (indices_begin + indices_i)->id = id; @@ -273,7 +273,7 @@ class TypedSorterImpl : public CodeGenBase { arrow::UInt64Builder builder; auto *index = (ArrayItemIndexS *) indices_out->value_data(); for (int i = 0; i < indices_out->length(); i++) { - uint64_t encoded = ((uint64_t) (index->array_id) << 16U) ^ ((uint64_t) (index->id)); + uint64_t encoded = ((uint64_t) (index->array_id) << 32U) ^ ((uint64_t) (index->id)); RETURN_NOT_OK(builder.Append(encoded)); index++; } @@ -538,7 +538,7 @@ class WindowSortOnekeyKernel : public WindowSortKernel::Impl { std::dynamic_pointer_cast(in); for (int i = 0; i < selected->length(); i++) { uint64_t encoded = selected->GetView(i); - uint16_t array_id = (encoded & 0xFFFF0000U) >> 16U; + uint16_t array_id = (encoded & 0xFFFF0000U) >> 32U; uint16_t id = encoded & 0xFFFFU; auto key_clip = cached_key_.at(array_id); if (key_clip->IsNull(id)) { @@ -561,7 +561,7 @@ class WindowSortOnekeyKernel : public WindowSortKernel::Impl { // we should also support desc and asc here for (int i = 0; i < selected->length(); i++) { uint64_t encoded = selected->GetView(i); - uint16_t array_id = (encoded & 0xFFFF0000U) >> 16U; + uint16_t array_id = (encoded & 0xFFFF0000U) >> 32U; uint16_t id = encoded & 0xFFFFU; auto key_clip = cached_key_.at(array_id); if (nulls_first_) { @@ -621,7 +621,7 @@ class WindowSortOnekeyKernel : public WindowSortKernel::Impl { arrow::UInt64Builder builder; auto* index = (ArrayItemIndexS*)indices_out->value_data(); for (int i = 0; i < indices_out->length(); i++) { - uint64_t encoded = ((uint64_t)(index->array_id) << 16U) ^ ((uint64_t)(index->id)); + uint64_t encoded = ((uint64_t)(index->array_id) << 32U) ^ ((uint64_t)(index->id)); RETURN_NOT_OK(builder.Append(encoded)); index++; }