[
https://issues.apache.org/jira/browse/FLINK-39276?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sergey Nuyanzin updated FLINK-39276:
------------------------------------
Description:
The problem is that
if there is existing materialized table {{mt}} with schema
{noformat}
`a` BIGINT NOT NULL, `b` STRING, `c` INT, `d` STRING
{noformat}
and then we use {{CREATE OR ALTER}} like
{code:sql}
CREATE OR ALTER MATERIALIZED TABLE mt (
`a` BIGINT NOT NULL, `b` STRING, `c` INT, `d` STRING, `a1` BIGINT NOT NULL)
AS SELECT a, b, c, d, a as `a1` FROM t3
{code}
then it will update existing schema adding {{`a1` BIGINT}}, i.e. it omits
nullability.
It would make sense if there is no explicit schema mentioned
however in case of schema is present it should respect it
was:
The problem is that
if there is existing materialized table {{mt}} with schema
{noformat}
`a` BIGINT NOT NULL, `b` STRING, `c` INT, `d` STRING
{noformat}
and then we use {{CREATE OR ALTER}} like
{code:sql}
CREATE OR ALTER MATERIALIZED TABLE base_mtbl (
`a` BIGINT NOT NULL, `b` STRING, `c` INT, `d` STRING, `a1` BIGINT NOT NULL)
AS SELECT a, b, c, d, a as `a1` FROM t3
{code}
then it will update existing schema adding {{`a1` BIGINT NOT}}, i.e. it omits
nullability.
It would make sense if there is no explicit schema mentioned
however in case of schema is present it should respect it
> CREATE OR ALTER MATERIALIZED TABLE should respect nullability defined in
> schema
> -------------------------------------------------------------------------------
>
> Key: FLINK-39276
> URL: https://issues.apache.org/jira/browse/FLINK-39276
> Project: Flink
> Issue Type: Sub-task
> Components: Table SQL / Planner
> Reporter: Sergey Nuyanzin
> Assignee: Sergey Nuyanzin
> Priority: Major
> Labels: pull-request-available
>
> The problem is that
> if there is existing materialized table {{mt}} with schema
> {noformat}
> `a` BIGINT NOT NULL, `b` STRING, `c` INT, `d` STRING
> {noformat}
> and then we use {{CREATE OR ALTER}} like
> {code:sql}
> CREATE OR ALTER MATERIALIZED TABLE mt (
> `a` BIGINT NOT NULL, `b` STRING, `c` INT, `d` STRING, `a1` BIGINT NOT NULL)
> AS SELECT a, b, c, d, a as `a1` FROM t3
> {code}
> then it will update existing schema adding {{`a1` BIGINT}}, i.e. it omits
> nullability.
> It would make sense if there is no explicit schema mentioned
> however in case of schema is present it should respect it
--
This message was sent by Atlassian Jira
(v8.20.10#820010)