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

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


The following commit(s) were added to refs/heads/master by this push:
     new 33736e4  [fix](table-function) Fixed unreasonable nullable conversion 
(#8818)
33736e4 is described below

commit 33736e45fa5d47aaafb05cf97d5b368a23eb971c
Author: HappenLee <happen...@hotmail.com>
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 3240df5..3b44b43 100644
--- a/be/src/exec/table_function_node.cpp
+++ b/be/src/exec/table_function_node.cpp
@@ -269,20 +269,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 be02d77..9d17836 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: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to