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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/CreateTableCommand.java:
##########
@@ -184,7 +185,9 @@ public void validateCreateTableAsSelect(ConnectContext ctx, 
LogicalPlan query) {
             Slot s = slots.get(i);
             DataType dataType = s.getDataType().conversion();
             if (dataType instanceof VariantType) {
-                dataType = ((VariantType) dataType).withoutPredefinedFields();
+                // the created column is new, even when the query reads an old 
V1 or an external column
+                dataType = ((VariantType) dataType).withoutPredefinedFields()
+                        .withSerializeType(TVariantSerializeType.V2);

Review Comment:
   [P2] Promote inferred materialized-view columns to V2 too
   
   This promotion only covers CTAS. For an asynchronous MV whose query is 
`SELECT k, parse_to_variant('{"a":1}') AS v FROM src` (`Project(k, 
parse_to_variant(...) AS v) -> Scan(src)`), 
`MTMVPlanUtil.generateColumns/getDataType` takes the expression's 
`VariantType.INSTANCE` through `conversion()` and persists it unchanged as V1 
with count 0. On refresh, `select_variant_paths` therefore extracts every 
dynamic path, although the equivalent new CTAS column is V2 and extracts none. 
Apply the new-column promotion to the MV creation path as well, preferably 
through a shared helper, and cover an inferred VARIANT expression there.



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