hello-stephen commented on code in PR #70408:
URL: https://github.com/apache/doris/pull/70408#discussion_r4731877210


##########
fe/fe-type/src/main/java/org/apache/doris/catalog/VariantType.java:
##########
@@ -172,24 +205,24 @@ public String toSql(int depth) {
             sb.append("\"variant_enable_doc_mode\" = \"")
                                     
.append(String.valueOf(enableVariantDocMode)).append("\"");
             sb.append(",");
-            sb.append("\"variant_doc_materialization_min_rows\" = \"")
-                                        
.append(String.valueOf(variantDocMaterializationMinRows)).append("\"");
-            sb.append(",");
-            sb.append("\"variant_doc_hash_shard_count\" = \"")
-                                        
.append(String.valueOf(variantDocShardCount)).append("\"");
+            sb.append("\"variant_max_subcolumns_count\" = \"")
+                                    
.append(String.valueOf(variantMaxSubcolumnsCount)).append("\"");
         } else {
             sb.append("\"variant_max_subcolumns_count\" = \"")
                                     
.append(String.valueOf(variantMaxSubcolumnsCount)).append("\"");
             sb.append(",");
-            sb.append("\"variant_enable_typed_paths_to_sparse\" = \"")
-                                        
.append(String.valueOf(enableTypedPathsToSparse)).append("\"");
-            sb.append(",");
             sb.append("\"variant_max_sparse_column_statistics_size\" = \"")
                                         
.append(String.valueOf(variantMaxSparseColumnStatisticsSize)).append("\"");
+        }
+        if (!enableNestedGroup) {
+            sb.append(",");
+            sb.append("\"variant_doc_materialization_min_rows\" = \"")
+                                        
.append(String.valueOf(variantDocMaterializationMinRows)).append("\"");
             sb.append(",");
-            // Output at least 1 for backward compatibility: old data without 
this parameter defaults to 0
-            sb.append("\"variant_sparse_hash_shard_count\" = \"")
-                                        .append(String.valueOf(Math.max(1, 
variantSparseHashShardCount))).append("\"");
+            // The field of the column's mode holds the shard count. Output at 
least 1 for backward compatibility:
+            // old data without the parameter defaults to 0.
+            sb.append("\"variant_doc_hash_shard_count\" = \"")
+                    
.append(String.valueOf(effectiveShardCount())).append("\"");

Review Comment:
   [P2] Keep DOC shard metadata consistent with printed DDL
   
   New DOC columns store the default shard count as 0, but this printer emits 
`variant_doc_hash_shard_count="1"`. Copying that exact DESC/SHOW CREATE type 
into a comment-only `MODIFY COLUMN` parses 1; 
`inheritImmutableVariantProperties()` preserves only the version and typed-path 
flag, and `Column.checkSchemaChangeAllowed()` rejects raw 0 != 1 with "Can not 
change variant doc snapshot shard count" before normalized equality can help. 
This also affects explicitly configured DOC shard count 0 and did not happen 
when DOC SQL printed the raw value. Preserve the raw DOC value in SQL or 
normalize 0/1 in the schema-change check, and cover this CREATE/print/MODIFY 
roundtrip.



##########
regression-test/suites/fault_injection_p0/test_variant_compaction_with_sparse_limit.groovy:
##########
@@ -47,6 +47,7 @@ suite("test_compaction_variant_with_sparse_limit", 
"nonConcurrent") {
             max_subcolumns_count = 0

Review Comment:
   [P2] Update the zero-budget fault check for V2
   
   This branch maps two of five random draws to count 0, but new CREATE columns 
are V2, so 0 now keeps every dynamic path sparse. The first insert puts `a`/`x` 
in sparse statistics, and `check_sparse_column_must_not_be_read()` then enables 
`exist_in_sparse_column_must_be_false` and gets an InternalError on its first 
SELECT. The surrounding catch logs and consumes that error before any 
query-result or compaction checks, so the suite can pass while skipping all 
DUPLICATE/UNIQUE/AGGREGATE compaction coverage in 40% of runs. Use a positive 
extraction budget for the no-sparse branch or assert the new count-zero 
behavior, and propagate unexpected failures.



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