[fix](table-function) Fix bug of table function with outer join cause nullptr of tuple (#9041)
This commit is contained in:
@ -273,23 +273,29 @@ Status TableFunctionNode::get_next(RuntimeState* state, RowBatch* row_batch, boo
|
||||
Tuple* child_tuple = _cur_child_tuple_row->get_tuple(
|
||||
child_rowdesc.get_tuple_idx(child_tuple_desc->id()));
|
||||
|
||||
// copy the child tuple to parent_tuple
|
||||
memcpy(tuple_ptr, child_tuple, parent_tuple_desc->byte_size());
|
||||
// only deep copy the child slot if it is selected and is var len (Eg: string, bitmap, hll)
|
||||
for (int j = 0; j < _child_slot_sizes[i]; ++j) {
|
||||
SlotDescriptor* child_slot_desc = child_tuple_desc->slots()[j];
|
||||
SlotDescriptor* parent_slot_desc = parent_tuple_desc->slots()[j];
|
||||
// The child tuple is nullptr, only when the child tuple is from outer join. so we directly set
|
||||
// parent_tuple have same tuple_idx nullptr to mock the behavior
|
||||
if (child_tuple != nullptr) {
|
||||
// copy the child tuple to parent_tuple
|
||||
memcpy(tuple_ptr, child_tuple, parent_tuple_desc->byte_size());
|
||||
// only deep copy the child slot if it is selected and is var len (Eg: string, bitmap, hll)
|
||||
for (int j = 0; j < _child_slot_sizes[i]; ++j) {
|
||||
SlotDescriptor *child_slot_desc = child_tuple_desc->slots()[j];
|
||||
SlotDescriptor *parent_slot_desc = parent_tuple_desc->slots()[j];
|
||||
|
||||
if (_output_slot_ids[parent_slot_desc->id()] &&
|
||||
!child_tuple->is_null(child_slot_desc->null_indicator_offset())
|
||||
&& child_slot_desc->type().is_string_type()) {
|
||||
void* dest_slot = tuple_ptr->get_slot(parent_slot_desc->tuple_offset());
|
||||
RawValue::write(child_tuple->get_slot(child_slot_desc->tuple_offset()),
|
||||
dest_slot, parent_slot_desc->type(),
|
||||
row_batch->tuple_data_pool());
|
||||
if (_output_slot_ids[parent_slot_desc->id()] &&
|
||||
!child_tuple->is_null(child_slot_desc->null_indicator_offset())
|
||||
&& child_slot_desc->type().is_string_type()) {
|
||||
void *dest_slot = tuple_ptr->get_slot(parent_slot_desc->tuple_offset());
|
||||
RawValue::write(child_tuple->get_slot(child_slot_desc->tuple_offset()),
|
||||
dest_slot, parent_slot_desc->type(),
|
||||
row_batch->tuple_data_pool());
|
||||
}
|
||||
}
|
||||
parent_tuple_row->set_tuple(tuple_idx, tuple_ptr);
|
||||
} else {
|
||||
parent_tuple_row->set_tuple(tuple_idx, nullptr);
|
||||
}
|
||||
parent_tuple_row->set_tuple(tuple_idx, tuple_ptr);
|
||||
tuple_ptr = reinterpret_cast<Tuple*>(reinterpret_cast<uint8_t*>(tuple_ptr) +
|
||||
parent_tuple_desc->byte_size());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user