HappenLee commented on code in PR #62069:
URL: https://github.com/apache/doris/pull/62069#discussion_r3031720228


##########
be/src/exec/operator/table_function_operator.cpp:
##########
@@ -264,30 +266,135 @@ Status 
TableFunctionLocalState::_get_expanded_block_block_fast_path(
     const auto& offsets = *_block_fast_path_ctx.offsets_ptr;
     const auto child_rows = cast_set<int64_t>(offsets.size());
 
-    std::vector<uint32_t> row_ids;
-    row_ids.reserve(remaining_capacity);
-    uint64_t first_nested_idx = 0;
-    uint64_t expected_next_nested_idx = 0;
-    bool found_nested_range = false;
-
     int64_t child_row = _block_fast_path_row;
     uint64_t in_row_offset = _block_fast_path_in_row_offset;
     int produced_rows = 0;
 
-    while (produced_rows < remaining_capacity && child_row < child_rows) {
-        if (_block_fast_path_ctx.array_nullmap_data &&
-            _block_fast_path_ctx.array_nullmap_data[child_row]) {
-            // NULL array row: skip it here. Slow path will handle output 
semantics if needed.
-            child_row++;
-            in_row_offset = 0;
-            continue;
+    const bool is_outer = _fns[0]->is_outer();
+    const bool is_posexplode = _block_fast_path_ctx.generate_row_index;
+    auto& out_col = columns[p._child_slots.size()];
+
+    // Decompose posexplode struct output column if needed
+    ColumnStruct* struct_col_ptr = nullptr;
+    ColumnUInt8* outer_struct_nullmap_ptr = nullptr;
+    IColumn* value_col_ptr = nullptr;
+    ColumnInt32* pos_col_ptr = nullptr;
+    if (is_posexplode) {
+        if (out_col->is_nullable()) {
+            auto* nullable = assert_cast<ColumnNullable*>(out_col.get());
+            struct_col_ptr = 
assert_cast<ColumnStruct*>(nullable->get_nested_column_ptr().get());
+            outer_struct_nullmap_ptr =
+                    
assert_cast<ColumnUInt8*>(nullable->get_null_map_column_ptr().get());
+        } else {
+            struct_col_ptr = assert_cast<ColumnStruct*>(out_col.get());
+        }
+        pos_col_ptr = 
assert_cast<ColumnInt32*>(&struct_col_ptr->get_column(0));
+        value_col_ptr = &struct_col_ptr->get_column(1);
+    }
+    // Segment tracking: accumulate contiguous nested ranges, flush on 
boundaries.

Review Comment:
   是不是可以考虑把这些变量变成一个类来管理,比如fast_segment?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to