diff --git a/be/src/exec/base_scanner.cpp b/be/src/exec/base_scanner.cpp index 7764acc35820a5..617723cd75e8a0 100644 --- a/be/src/exec/base_scanner.cpp +++ b/be/src/exec/base_scanner.cpp @@ -154,10 +154,11 @@ bool BaseScanner::fill_dest_tuple(const Slice& line, Tuple* dest_tuple, MemPool* ctx->clear_error_msg(); return false; } - SlotDescriptor* slot_descriptor = _src_slot_descs_order_by_dest[dest_index]; - if (_strict_mode && (slot_descriptor != nullptr)&& !_src_tuple->is_null(slot_descriptor->null_indicator_offset())) { + // If _strict_mode is false, _src_slot_descs_order_by_dest size could be zero + if (_strict_mode && (_src_slot_descs_order_by_dest[dest_index] != nullptr) && + !_src_tuple->is_null(_src_slot_descs_order_by_dest[dest_index]->null_indicator_offset())) { //Type of the slot is must be Varchar in _src_tuple. - StringValue* raw_value = _src_tuple->get_string_slot(slot_descriptor->tuple_offset()); + StringValue* raw_value = _src_tuple->get_string_slot(_src_slot_descs_order_by_dest[dest_index]->tuple_offset()); std::string raw_string; if (raw_value != nullptr) {//is not null then get raw value raw_string = raw_value->to_string(); diff --git a/be/test/exec/parquet_scanner_test.cpp b/be/test/exec/parquet_scanner_test.cpp index 81ff2e1c0588bf..64941f87824f5c 100644 --- a/be/test/exec/parquet_scanner_test.cpp +++ b/be/test/exec/parquet_scanner_test.cpp @@ -462,23 +462,22 @@ TEST_F(ParquetSannerTest, normal) { MemTracker tracker; // Get batch RowBatch batch(scan_node.row_desc(), _runtime_state.batch_size(), &tracker); - std::cout << time(NULL) << std::endl; bool eof = false; for (int i = 0; i < 14; i++) { status = scan_node.get_next(&_runtime_state, &batch, &eof); + ASSERT_TRUE(status.ok()); ASSERT_EQ(2048, batch.num_rows()); - //ASSERT_EQ(1000, batch.num_rows()); ASSERT_FALSE(eof); batch.reset(); } status = scan_node.get_next(&_runtime_state, &batch, &eof); + ASSERT_TRUE(status.ok()); ASSERT_EQ(1328, batch.num_rows()); - //ASSERT_EQ(1000, batch.num_rows()); ASSERT_FALSE(eof); batch.reset(); - std::cout << time(NULL) << std::endl; status = scan_node.get_next(&_runtime_state, &batch, &eof); + ASSERT_TRUE(status.ok()); ASSERT_EQ(0, batch.num_rows()); ASSERT_TRUE(eof); @@ -493,12 +492,6 @@ TEST_F(ParquetSannerTest, normal) { } int main(int argc, char** argv) { - // std::string conffile = std::string(getenv("DORIS_HOME")) + "/conf/be.conf"; - // if (!doris::config::init(conffile.c_str(), false)) { - // fprintf(stderr, "error read config file. \n"); - // return -1; - // } - // init_glog("be-test"); ::testing::InitGoogleTest(&argc, argv); doris::CpuInfo::init(); return RUN_ALL_TESTS();