jackylee-ch opened a new pull request, #9670: URL: https://github.com/apache/paimon/pull/9670
### Purpose The three date/time-to-string cast rules target `VarCharType.STRING_TYPE`, so `CastExecutors` only matches a type equal to it — a bounded `VARCHAR(n)`/`CHAR(n)`, or a plain `STRING NOT NULL`, resolves to no rule. `SchemaManagerUtils` treats a null executor as a rejection even though `DataTypeCasts.supportsCast` allows the change, so `ALTER TABLE T MODIFY (b VARCHAR(10))` on a `TIMESTAMP(3)` column fails with "cannot be converted to VARCHAR(10) without losing information", while the same statement on an `INT` column works. Keyed on `DataTypeFamily.CHARACTER_STRING` now, which the class javadoc of all three already claims, trimming and padding through `BinaryStringUtils` like the numeric and boolean rules. Truncating to a bounded target and blank padding `CHAR` is existing asserted behaviour for the other scalars (`testModifyColumnTypeFromNumericToString`, 47d4dd6fd). This also unblocks Spark's `CAST(<datetime> AS VARCHAR(n))` pushdown through `CastTransform`, with the truncating semantics `INT` already has. ### Tests `DateTimeToCharacterStringCastRuleTest`, and `SchemaChangeITCase.testModifyColumnTypeFromTimestampToBoundedString`, which fails on master with the exception above. Written with Claude Code; reasoning and verification are mine. -- 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]
