This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch dev-1.0.1
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git

commit e4cf47ac9362983298979b89b94590bc05492033
Author: HappenLee <[email protected]>
AuthorDate: Sun Apr 3 11:02:35 2022 +0800

    [fix](table-function) Fixed unreasonable nullable conversion (#8818)
---
 be/src/exec/table_function_node.cpp                      | 11 ++++++-----
 .../java/org/apache/doris/planner/TableFunctionNode.java | 16 ----------------
 2 files changed, 6 insertions(+), 21 deletions(-)

diff --git a/be/src/exec/table_function_node.cpp 
b/be/src/exec/table_function_node.cpp
index db262054c6..126e397c9a 100644
--- a/be/src/exec/table_function_node.cpp
+++ b/be/src/exec/table_function_node.cpp
@@ -270,20 +270,21 @@ 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];
 
                     if (_output_slot_ids[parent_slot_desc->id()] &&
-                        
!child_tuple->is_null(child_slot_desc->null_indicator_offset())) {
-                        // only write child slot if it is selected and not 
null.
+                        
!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());
-                        
tuple_ptr->set_not_null(parent_slot_desc->null_indicator_offset());
-                    } else {
-                        
tuple_ptr->set_null(parent_slot_desc->null_indicator_offset());
                     }
                 }
                 parent_tuple_row->set_tuple(tuple_idx, tuple_ptr);
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/planner/TableFunctionNode.java 
b/fe/fe-core/src/main/java/org/apache/doris/planner/TableFunctionNode.java
index be02d77f9b..9d17836aa0 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/planner/TableFunctionNode.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/planner/TableFunctionNode.java
@@ -21,10 +21,8 @@ import org.apache.doris.analysis.Analyzer;
 import org.apache.doris.analysis.Expr;
 import org.apache.doris.analysis.LateralViewRef;
 import org.apache.doris.analysis.SelectStmt;
-import org.apache.doris.analysis.SlotDescriptor;
 import org.apache.doris.analysis.SlotId;
 import org.apache.doris.analysis.SlotRef;
-import org.apache.doris.analysis.TupleDescriptor;
 import org.apache.doris.analysis.TupleId;
 import org.apache.doris.common.AnalysisException;
 import org.apache.doris.common.UserException;
@@ -110,20 +108,6 @@ public class TableFunctionNode extends PlanNode {
         for (SlotRef slotRef : outputSlotRef) {
             outputSlotIds.add(slotRef.getSlotId());
         }
-
-        // For all other slots from input node which are not in outputSlotIds,
-        // set them as nullable, so that we can set them to null in 
TableFunctionNode
-        // TODO(cmy): This should be done with a ProjectionNode
-        PlanNode inputNode = getChild(0);
-        List<TupleId> inputTupleIds = inputNode.getTupleIds();
-        for (TupleId tupleId : inputTupleIds) {
-            TupleDescriptor td = analyzer.getTupleDesc(tupleId);
-            for (SlotDescriptor sd : td.getSlots()) {
-                if (!outputSlotIds.contains(sd.getId())) {
-                    sd.setIsNullable(true);
-                }
-            }
-        }
     }
 
     @Override


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to