From b4af98a1dbe25c97ee50d16037860414b5455156 Mon Sep 17 00:00:00 2001 From: Logan Riggs Date: Mon, 6 Nov 2023 13:37:35 -0800 Subject: [PATCH] Fix unit tests --- cpp/src/gandiva/annotator.cc | 4 +++- cpp/src/gandiva/array_ops_test.cc | 2 +- cpp/src/gandiva/llvm_generator.cc | 2 -- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cpp/src/gandiva/annotator.cc b/cpp/src/gandiva/annotator.cc index 04821c945e5f7..45500a785c7c7 100644 --- a/cpp/src/gandiva/annotator.cc +++ b/cpp/src/gandiva/annotator.cc @@ -62,7 +62,9 @@ FieldDescriptorPtr Annotator::MakeDesc(FieldPtr field, bool is_output) { data_buffer_ptr_idx = buffer_count_++; } int child_valid_buffer_ptr_idx = FieldDescriptor::kInvalidIdx; - child_valid_buffer_ptr_idx = buffer_count_++; + if (field->type()->id() == arrow::Type::LIST) { + child_valid_buffer_ptr_idx = buffer_count_++; + } return std::make_shared(field, data_idx, validity_idx, offsets_idx, data_buffer_ptr_idx, child_offsets_idx, child_valid_buffer_ptr_idx); } diff --git a/cpp/src/gandiva/array_ops_test.cc b/cpp/src/gandiva/array_ops_test.cc index fe83ad6260095..bf01c1fe0a091 100644 --- a/cpp/src/gandiva/array_ops_test.cc +++ b/cpp/src/gandiva/array_ops_test.cc @@ -34,7 +34,7 @@ TEST(TestArrayOps, TestInt32ContainsInt32) { EXPECT_EQ( array_int32_contains_int32(ctx_ptr, data, entry_offsets_len, &entry_validity, - true, contains_data, true, 0, 0, &valid), + true, contains_data, true, 0, 3, &valid), true); } diff --git a/cpp/src/gandiva/llvm_generator.cc b/cpp/src/gandiva/llvm_generator.cc index 11fd2d3cb1947..0c1478894a838 100644 --- a/cpp/src/gandiva/llvm_generator.cc +++ b/cpp/src/gandiva/llvm_generator.cc @@ -787,10 +787,8 @@ void LLVMGenerator::Visitor::Visit(const VectorReadVarLenValueListDex& dex) { builder->CreateAdd(loop_var_, GetSliceOffset(dex.OffsetsIdx())); int i = 0; - std::cout << "VectorReadVarLenValueListDex " << i++ << std::endl; // => offset_start = offsets[loop_var] slot = builder->CreateGEP(type, offsets_slot_ref, offsets_slot_index); - std::cout << "VectorReadVarLenValueListDex " << i++ << std::endl; llvm::Value* offset_start = builder->CreateLoad(type, slot, "offset_start"); // => offset_end = offsets[loop_var + 1]