Timo Theusner created FLINK-41527:
-------------------------------------
Summary: Reject repeated column names in CTAS, RTAS and
materialized table column lists
Key: FLINK-41527
URL: https://issues.apache.org/jira/browse/FLINK-41527
Project: Flink
Issue Type: Bug
Components: Table SQL / API, Table SQL / Planner
Reporter: Timo Theusner
CTAS, RTAS, {{CREATE MATERIALIZED TABLE}} and {{CREATE OR ALTER MATERIALIZED
TABLE}} accept a column list that names a query column twice: {{(a BIGINT, a
DOUBLE)}} silently keeps the last declaration, and {{(a, a) AS SELECT a, b}}
silently drops {{b}} from the table and the query. These statements should fail
with a {{ValidationException}}, as plain {{CREATE TABLE}} and {{INSERT INTO}}
already do.
Proposed Changes
* Reject a repeated declared column name in
{{AsQuerySchemaMerger#addDeclaredColumn}}, also when the query produces that
column
* Reject repeated names in {{MergeTableAsUtil.SchemaBuilder#reorderColumns}}
before the column-count check
* Remove the separate repeat check in
{{DescriptorMaterializedTableMergeContext#getMergedSchema}} (FLINK-41237), now
covered by {{AsQuerySchemaMerger}}
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)