[
https://issues.apache.org/jira/browse/FLINK-22196?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Lsw_aka_laplace resolved FLINK-22196.
-------------------------------------
Resolution: Fixed
> FlinkRelMdUniqueKeys#getTableUniqueKeys should filter out the column indices
> which the does not exist in current row schema
> ----------------------------------------------------------------------------------------------------------------------------
>
> Key: FLINK-22196
> URL: https://issues.apache.org/jira/browse/FLINK-22196
> Project: Flink
> Issue Type: Bug
> Components: Table SQL / Planner
> Affects Versions: 1.12.2
> Reporter: Lsw_aka_laplace
> Assignee: Lsw_aka_laplace
> Priority: Major
> Fix For: 1.13.0
>
>
> Well since we have supported project push-down, some primary-key in original
> schema may not exist no longer more, so the non-existed column shall be
> filtered out.
>
> Current code:
> {code:java}
> val columns = relOptTable.getRowType.getFieldNames
> val columnIndices = schema.getPrimaryKey.get().getColumns map { c =>
> columns.indexOf(c)
> }
> {code}
> May be supposed to correct to:
> {code:java}
> val columns = relOptTable.getRowType.getFieldNames
> val columnIndices = schema
> .getPrimaryKey
> .get()
> .getColumns
> .map(columns.indexOf)
> .filterNot(_ == -1) // filter out the non-exist column
> {code}
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)