csun5285 commented on code in PR #70408:
URL: https://github.com/apache/doris/pull/70408#discussion_r4749587794
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/types/VariantType.java:
##########
@@ -130,14 +136,43 @@ public DataType conversion() {
.collect(Collectors.toList()),
variantMaxSubcolumnsCount, enableTypedPathsToSparse,
variantMaxSparseColumnStatisticsSize,
variantSparseHashShardCount,
enableVariantDocMode,
variantDocMaterializationMinRows,
- variantDocShardCount, enableNestedGroup);
+ variantDocShardCount, enableNestedGroup,
variantSerializeType);
+ }
+
+ /** This type with the given serialize type, as a new instance. */
+ public VariantType withSerializeType(TVariantSerializeType serializeType) {
+ return new VariantType(predefinedFields, variantMaxSubcolumnsCount,
enableTypedPathsToSparse,
+ variantMaxSparseColumnStatisticsSize,
variantSparseHashShardCount, enableVariantDocMode,
+ variantDocMaterializationMinRows, variantDocShardCount,
enableNestedGroup, serializeType);
+ }
+
+ /** This type with the given max subcolumns count, as a new instance. */
+ public VariantType withMaxSubcolumnsCount(int maxSubcolumnsCount) {
+ return new VariantType(predefinedFields, maxSubcolumnsCount,
enableTypedPathsToSparse,
+ variantMaxSparseColumnStatisticsSize,
variantSparseHashShardCount, enableVariantDocMode,
+ variantDocMaterializationMinRows, variantDocShardCount,
enableNestedGroup, variantSerializeType);
+ }
+
+ /**
+ * Resolves a VARIANT type for a newly created table/MV column. Unbound
compute placeholders
+ * ({@link #INSTANCE} or {@link ConnectorComputeVariantType}) and pruned
sub-paths carry no
+ * independent subcolumn limit, so they adopt the default limit alongside
V2, except when
+ * nested group is enabled (which requires max subcolumns count to stay 0).
+ */
+ public VariantType forNewTableColumn(DataType rawType, boolean isSubPath,
int defaultMaxSubcolumnsCount) {
+ VariantType result = this.withSerializeType(TVariantSerializeType.V2);
+ if (!result.enableNestedGroup
+ && (isSubPath || rawType == INSTANCE || rawType instanceof
ConnectorComputeVariantType)) {
Review Comment:
ixed in eabace67349: ElementAt now returns VariantType.INSTANCE, and CTAS,
Sync MV, and MTMV all share VariantType.resolveForNewColumn to reset sub-paths,
computed expressions, external columns, and TVFs to fresh default V2 properties.
--
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]