924060929 commented on code in PR #70223:
URL: https://github.com/apache/doris/pull/70223#discussion_r4779067463
##########
fe/fe-core/src/main/java/org/apache/doris/backup/RestoreJob.java:
##########
@@ -759,7 +762,8 @@ private void checkAndPrepareMeta() {
BackupHandler.SIGNATURE_VERSION,
intersectPartNames);
String remoteTblSignature = remoteOlapTbl.getSignature(
BackupHandler.SIGNATURE_VERSION,
intersectPartNames);
- if (!localTblSignature.equals(remoteTblSignature)) {
+ if (!localTblSignature.equals(remoteTblSignature)
+ ||
!aggStateSignatures(localOlapTbl).equals(aggStateSignatures(remoteOlapTbl))) {
Review Comment:
[P1] When `isForceReplace` is true, evaluating
`aggStateSignatures(localOlapTbl)` before entering the force-replace branch can
throw `AnalysisException` if the local table has an unresolvable legacy
`AGG_STATE` column. The outer `catch (AnalysisException)` then aborts the
restore with `COMMON_ERROR`, preventing `FORCE` from replacing the broken local
table. Under `isForceReplace`, treat local signature inference failures as a
schema mismatch so force replacement can proceed.
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/ColumnToProtobuf.java:
##########
@@ -136,6 +148,69 @@ public static OlapFile.ColumnPB toPb(Column column,
Set<String> bfColumns, List<
return builder.build();
}
+ private static Types.PTypeDesc aggStateResultToPb(TTypeDesc type) {
Review Comment:
[P2] Manually translating `TTypeDesc -> PTypeDesc` inside `ColumnToProtobuf`
duplicates type-serialization logic and is easy to drift whenever new type
attributes are added to `TScalarType`/`TTypeNode` (e.g.
`spatial_crs`/`spatial_algorithm` are currently not copied here). Consider
extracting a shared `Type -> PTypeDesc` (or `TTypeDesc -> PTypeDesc`) converter
in `fe-type` instead of maintaining a separate copy here.
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/types/AggStateType.java:
##########
@@ -101,14 +190,16 @@ public String getFunctionName() {
@Override
public Type toCatalogDataType() {
List<Type> types =
subTypes.stream().map(DataType::toCatalogDataType).collect(Collectors.toList());
- return new org.apache.doris.catalog.AggStateType(functionName,
returnNullable, types, subTypeNullables);
+ return new org.apache.doris.catalog.AggStateType(functionName,
returnNullable, types, subTypeNullables,
+ resultTypeInferredFromLegacy || resultType == null ? null :
resultType.toCatalogDataType());
Review Comment:
[P2] Pass-through nested `AGG_STATE` types (e.g.
`any_value_state(any_value_state(...sum_state(1)...))`) store the same inner
`AggStateType` in both `subTypes` and `resultType`. Recursing into both
branches independently in `toCatalogDataType()` (and later `toThrift()`) causes
$2^N$ exponential expansion (20 wrappers -> ~2M objects), which can easily OOM
FE. Consider bounding `AGG_STATE` nesting depth (e.g. `Type.MAX_NESTING_DEPTH`)
or avoiding duplicate expansion for pass-through result types.
##########
fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java:
##########
@@ -1924,6 +1936,10 @@ private void createJob(String rawSql, long dbId,
OlapTable olapTable, Map<Long,
if (!alterColumn.equals(oriColumn)) {
// 3.1 check type
oriColumn.checkSchemaChangeAllowed(alterColumn);
+ // Validate the rewrite before creating shadow
tablets or persisting the job.
+ if (!Objects.equals(oriColumn.getType(),
alterColumn.getType())) {
+ checkColumnTypeConversion(oriColumn,
alterColumn);
Review Comment:
[P2] Calling `checkColumnTypeConversion` (backed by `CheckCast.check(src,
dst, false, false)`) for all column type changes expands the blast radius
beyond `AGG_STATE` (as seen by the `test_modify_struct` behavior change).
Please verify that every schema-change conversion allowed by
`Column.checkSchemaChangeAllowed` is also accepted by `CheckCast.check(...,
false, false)`, or scope the new check to `AGG_STATE` if full non-`AGG_STATE`
coverage is not intended here.
--
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]