github-actions[bot] commented on code in PR #69061:
URL: https://github.com/apache/doris/pull/69061#discussion_r4268166512
##########
fe/fe-core/src/main/java/org/apache/doris/analysis/ColumnDef.java:
##########
@@ -440,6 +441,11 @@ public static void validateDefaultValue(Type type, String
defaultValue, DefaultV
break;
case CHAR:
case VARCHAR:
+ // CHAR/VARCHAR length is in bytes, the same as the load path
checks.
+ if (defaultValue.getBytes(StandardCharsets.UTF_8).length >
scalarType.getLength()) {
Review Comment:
[P2] Preserve external CHAR default semantics
This shared validator also runs for external CREATE TABLE:
`CreateTableInfo.validate` passes `false` to `ColumnDefinition.validate`, which
still calls it unconditionally. On an HMS catalog supporting default
constraints, `CREATE TABLE hive_catalog.db.t (v CHAR(1) NULL DEFAULT 'δΈ')`
previously passed FE validation and is mapped by
`ConnectorColumnConverter`/`HmsTypeMapping` to Hive `char(1)` with that
default. [Hive CHAR limits are in
characters](https://hive.apache.org/docs/latest/language/languagemanual-types/#char),
so this value fits the target column, but the new check rejects it as three
UTF-8 bytes before reaching the connector. Scope byte-length enforcement to
Doris storage semantics and retain target-appropriate validation for external
tables; add an external CHAR default regression case.
--
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]