yuqi1129 opened a new pull request, #13975: URL: https://github.com/apache/gravitino/pull/13975
### What changes were proposed in this pull request? - `JdbcColumnDefaultValueConverter`: escape string, date and time default literals through a new overridable `quoteStringLiteral` (backslash escapes plus doubled apostrophes). Numeric defaults must parse as a number, or the request fails with `Invalid numeric column default value`. - PostgreSQL and Hologres: override `quoteStringLiteral` to double apostrophes only, and turn `''` back into `'` when parsing a default read from the database. - Doris CREATE TABLE: render string defaults in the form the Doris version stores correctly. 2.1 and later keep the literal text and parse it again as a double-quoted literal, so the value is double-quoted with backslash escapes. 1.2 decodes the literal at CREATE TABLE, so it keeps the single-quoted form. The version is looked up only when a string default contains `'`, `"` or `\`. ### Why are the changes needed? A default value that contains a quote produced invalid DDL, and a value carrying quotes and SQL text changed the generated statement. Fix: #13973 ### Does this PR introduce _any_ user-facing change? Yes. String defaults with quotes or backslashes are now stored as given. A non-numeric value for a numeric column default is rejected instead of being written into the DDL. ### How was this patch tested? - Unit tests for the common, PostgreSQL, Hologres and Doris converters, and Doris CREATE TABLE SQL generation. - New Docker cases that create a table, add a column and update a default with values such as `O'Brien`, `a""b`, `\path` and a trailing backslash, then check the loaded default (and, for Doris, the stored row): | Class | Result | |---|---| | `TestMysqlTableOperations` | 18 passed | | `TestPostgreSqlTableOperations` | 12 passed | | `TestOceanBaseTableOperations` | 19 passed | | `TestDorisTableOperations` (1.2) | 13 passed | | `CatalogDoris2xIT` (2.1.0, `-PdorisMultiVersionTest`) | 6 passed | The double-quoted Doris form was also checked on 3.0.6.2 and 4.0.6 (`CatalogDoris3xIT` / `CatalogDoris4xIT` passed) before the 1.2 path was made version-aware. `TestStarRocksTableOperations` and the version-aware rerun on 3.0 and 4.0 were not run locally. -- 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]
