[ 
https://issues.apache.org/jira/browse/FLINK-17845?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17123492#comment-17123492
 ] 

Rui Li commented on FLINK-17845:
--------------------------------

I agree it can be helpful to remove a property in certain scenarios. But the 
current behavior can also be desirable in some use cases. For example, if a 
user creates a table with 20 properties and later wants to update one of them. 
With the current semantics, he/she just needs to type this one specific 
property in the ALTER TABLE statement, instead of all the 20 properties.

In order to support the use case of "remove and replace previous properties", 
maybe we can introduce another DDL like "{{ALTER TABLE table_name REPLACE 
(key=val, ...)}}"?

Another question is why would a property typo make the table unusable? If the 
table has both {{'connector.topicX'}} and {{'connector.topic'}} in the 
properties, will there be a problem?

> Can't remove a table connector property with ALTER TABLE
> --------------------------------------------------------
>
>                 Key: FLINK-17845
>                 URL: https://issues.apache.org/jira/browse/FLINK-17845
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / API
>            Reporter: Fabian Hueske
>            Priority: Major
>
> It is not possible to remove an existing table property from a table.
> Looking at the [source 
> code|https://github.com/apache/flink/blob/master/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/sqlexec/SqlToOperationConverter.java#L295]
>  this seems to be the intended semantics, but it seems counter-intuitive to 
> me.
> If I create a table with the following statement:
> {code}
> CREATE TABLE `testTable` (
>   id INT
> )
> WITH (
>     'connector.type' = 'kafka',
>     'connector.version' = 'universal',
>     'connector.topicX' = 'test',      -- Woops, I made a typo here
>     [...]
> )
> {code}
> The statement will be successfully executed. However, the table cannot be 
> used due to the typo.
> Fixing the typo with the following DDL is not possible:
> {code}
> ALTER TABLE `testTable` SET (
>     'connector.type' = 'kafka',
>     'connector.version' = 'universal',
>     'connector.topic' = 'test',      -- Fixing the typo
> )
> {code}
> because the key {{connector.topicX}} is not removed.
> Right now it seems that the only way to fix a table with an invalid key is to 
> DROP and CREATE it. I think that this use case should be supported by ALTER 
> TABLE.
> I would even argue that the expected behavior is that previous properties are 
> removed and replaced by the new properties.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to