github-actions[bot] commented on code in PR #67809:
URL: https://github.com/apache/doris/pull/67809#discussion_r4014899489
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/GeneratedColumnDesc.java:
##########
@@ -50,7 +55,16 @@ public void setExpr(Expr expr) {
}
public Expression getExpression() {
- return expression;
+ // CREATE TABLE LIKE must also parse the expression under its original
session settings.
+ return sessionVariables.isPresent() ? new
NereidsParser().parseExpression(exprSql) : expression;
Review Comment:
[P1] Preserve legacy generated expressions without a session map
Generated columns existed before `Column.sessionVariables`, and replay
normalizes those missing maps to empty. CREATE LIKE makes that empty map
present, `AutoCloseSessionVariable` applies no override, and this line reparses
raw `exprSql` under the caller. A legacy source created with `PIPES_AS_CONCAT`
can therefore keep executing its serialized analyzed concat expression in
`BindSink`, while LIKE under the default mode reparses `a || 'x'` as OR and
silently creates a different target. For an empty legacy map, please derive the
clone from the persisted analyzed expression (or a mode-neutral canonical
rendering) and add an upgrade-compatibility test.
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/CreateTableLikeCommand.java:
##########
@@ -115,6 +128,10 @@ private void doRun(CreateTableLikeInfo
createTableLikeInfo, ConnectContext ctx,
createTableCommand = new
CreateTableCommand(createTableCommand.getCtasQuery(),
createTableInfo.withTableNameAndIfNotExists(createTableLikeInfo.getTableName(),
createTableLikeInfo.isIfNotExists()));
+ for (ColumnDefinition column :
createTableInfo.getColumnDefinitions()) {
Review Comment:
[P1] Apply the source SQL mode before the first DDL parse
These saved settings are attached only after `parseSingle` has already lexed
the rendered CREATE statement under the caller's `sql_mode`. `Column.toSql`
emits `GeneratedColumnInfo.exprSql` verbatim, so a source created with
`NO_BACKSLASH_ESCAPES` can validly store `concat(a, 'C:\')`; after the caller
clears that mode, the first parse treats the backslash as escaping the closing
quote and fails before this loop or `GeneratedColumnDesc.getExpression()` can
run. The lexer test for a trailing backslash already demonstrates this
token-boundary split. Please make the initial synthetic-DDL parse independent
of the caller mode (or activate the saved mode before it), and cover this
opposite-mode literal 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]