Yu Xu created CALCITE-7523:
------------------------------
Summary: Support the syntax SELECT * REPLACE(expr as column)
Key: CALCITE-7523
URL: https://issues.apache.org/jira/browse/CALCITE-7523
Project: Calcite
Issue Type: Improvement
Components: core
Affects Versions: 1.41.0
Reporter: Yu Xu
Assignee: Yu Xu
Fix For: 1.42.0
ClickHouse, Doris, StarRocks, Databend, BigQuery, Hive/Spark support *
REPLACE(expr as column);
eg,we can refer
ClickHouse:https://clickhouse.com/docs/zh/sql-reference/statements/select/replace-modifier
The benefits of introducing this syntax are:
1. Eliminates verbose column enumeration — When a table has dozens of columns
and you only need to transform one or two, `REPLACE` lets you keep the wildcard
while overriding just the columns that matter, avoiding long, error-prone
select lists.
2. Preserves schema stability — Unlike manually listing columns, `REPLACE`
maintains the original column names and their positional order. Adding a new
column to the table later won't break the query.
3. Complements `EXCLUDE` for full star-modification coverage — With both
`EXCLUDE` (remove columns) and `REPLACE` (overwrite columns), Calcite now
supports the complete set of ClickHouse-style star modifiers, making the Babel
dialect more feature-complete.
4. Reduces maintenance burden — Queries like `SELECT * REPLACE(UPPER(name) AS
name)` are self-documenting and easier to maintain than repeating every column
name just to apply a single expression.
5. ClickHouse compatibility — This syntax is natively supported by ClickHouse,
so adding it improves interoperability for users migrating or federating
queries from that system.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)