github-actions[bot] commented on code in PR #70408:
URL: https://github.com/apache/doris/pull/70408#discussion_r4661395658


##########
be/src/exec/common/variant_util.cpp:
##########
@@ -183,6 +183,43 @@ PathToDataTypes collect_regular_types_outside_nested_group(
     return regular_path_to_data_types;
 }
 
+namespace {
+
+// The dynamic paths of a doc column, chosen once for all doc buckets: each 
bucket writer sees only
+// its own paths. Typed paths do not count.
+void choose_doc_compaction_subpaths(const TabletSchema& target, const 
TabletColumn& column,
+                                    const PathToNoneNullValues& path_stats,
+                                    VariantCompactionPaths& paths_set_info) {
+    PathToNoneNullValues dynamic_path_stats;
+    for (const auto& [path, size] : path_stats) {
+        TabletSchema::SubColumnInfo typed_info;
+        if (!generate_sub_column_info(target, column.unique_id(), path, 
&typed_info)) {

Review Comment:
   [P2] Preserve structural nested paths during V2 count-zero compaction. 
`aggregate_variant_extended_info()` records legacy array/nested metadata in 
`nested_paths`, but this guard returns `InternalError` before 
`get_compaction_nested_columns()` can append that dedicated nested column. A V1 
rowset containing an array-of-objects path (for example `arr`) therefore 
remains uncompactable after the target schema is V2/count-zero even though the 
count only governs flat dynamic paths; the reader's new validation at 
`variant_column_reader.cpp:205` rejects the same non-typed nested entry. Exempt 
structurally nested paths from the dynamic-layout guard and let the existing 
nested materialization/reader path preserve them.



##########
fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPlanUtil.java:
##########
@@ -87,6 +87,7 @@
 import org.apache.doris.nereids.types.StringType;
 import org.apache.doris.nereids.types.TinyIntType;
 import org.apache.doris.nereids.types.VarcharType;
+import org.apache.doris.nereids.types.VariantType;
 import org.apache.doris.nereids.types.coercion.CharacterType;
 import org.apache.doris.nereids.util.ExpressionUtils;

Review Comment:
   [P2] Promote direct external VARIANT slots to V2 in MTMV schemas. 
`VARIANT_COMPUTE_V2` is converted to an ordinary V1 `VariantType` before this 
method, while an external scan slot still has an original column and empty 
subpath, so `tableColumn` is true and the `withSerializeType(V2)` branch is 
skipped. A newly created MTMV column with count zero consequently uses V1 and 
extracts every dynamic path on refresh, unlike CTAS's explicit external-column 
promotion. Restrict the source-layout shortcut to managed table columns (or 
detect the connector compute marker) and add an external VARIANT MTMV 
regression.



-- 
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