mrhhsg commented on code in PR #63528:
URL: https://github.com/apache/doris/pull/63528#discussion_r4227751423
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/load/NereidsDataDescription.java:
##########
@@ -599,10 +602,23 @@ private static void validateDefaultValue(List<String>
args, Column column) throw
}
if (args.get(0) != null) {
- ColumnDef.validateDefaultValue(column.getOriginType(),
args.get(0), column.getDefaultValueExprDef());
+ validateColumnValue(column, args.get(0));
}
}
+ private static void validateColumnValue(Column column, String value)
throws AnalysisException {
+ Type type = column.getOriginType();
+ if (type.isComplexType()) {
+ try {
+
ComplexTypeDefaultValue.canonicalize(DataType.fromCatalogType(type), value);
Review Comment:
Fixed in 63f64a36c00. `NereidsDataDescription` only validates a detached
copy of the arguments, so the rewrite is done where the mapping becomes the BE
expression: `NereidsLoadScanProvider.transformHadoopFunctionExpr` now passes
the validated argument (`default_value` child 0, `replace_value` child 1 in
both forms) through `canonicalizeComplexValue`, which replaces a string literal
on an ARRAY/MAP/STRUCT column with the canonical text from
`ComplexTypeDefaultValue.canonicalize`. Covered by
`NereidsLoadScanProviderTest.testComplexColumnMappingValueIsCanonicalized`
(both mapping forms, invalid value, scalar column untouched) and by the new
`test_complex_default_value_mapping` regression table: stream loads with
`replace_value(null, '[1e3, "7"]')` and `default_value('[1e3, "7"]')` now store
`[1000, 7]` instead of NULL elements.
--
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]