[Enhancement](table_function) table function node enhancement (#12038)

* table function node enhancement

* also avoid copy for non-vec table function node

* fix table function node output slots calculation while lateral view involves subquery

Co-authored-by: cambyzju <zhuxiaoli01@baidu.com>
This commit is contained in:
camby
2022-08-26 10:37:15 +08:00
committed by GitHub
parent ba11d8dc67
commit 0f4a1e811b
6 changed files with 71 additions and 9 deletions

View File

@ -300,13 +300,22 @@ Status TableFunctionNode::get_next(RuntimeState* state, RowBatch* row_batch, boo
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()) {
if (child_tuple->is_null(child_slot_desc->null_indicator_offset())) {
continue;
}
if (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()]) {
// deep coopy
RawValue::write(
child_tuple->get_slot(child_slot_desc->tuple_offset()),
dest_slot, parent_slot_desc->type(),
row_batch->tuple_data_pool());
} else {
// clear for unused slot
StringValue* dest = reinterpret_cast<StringValue*>(dest_slot);
dest->replace(nullptr, 0);
}
}
}
parent_tuple_row->set_tuple(tuple_idx, tuple_ptr);