[ 
https://issues.apache.org/jira/browse/SPARK-48130?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Patrick Grandjean updated SPARK-48130:
--------------------------------------
    Description: 
The function {{TableChange.updateColumnComment}} can be used to add a comment 
to a column, change it, but not remove the comment entry from the column's 
metadata.

Moreover, trying to update the column with value {{null}} risks raising a NPE 
if the function {{TableChange.UpdateColumnComment.equals}} is called.

Examples in Scala:
{code:scala}
TableChange.updateColumnComment(Array("foo"), "foo comment") // adds or changes 
comment => OK
TableChange.updateColumnComment(Array("foo"), "") // adds or changes comment to 
empty string, instead of removing comment from metadata => KO
TableChange.updateColumnComment(Array("foo"), null) // adds or changes comment 
to null, instead of removing comment from metadata => KO
TableChange.updateColumnComment(Array("foo"), "foo comment") == 
TableChange.updateColumnComment(Array("foo"), null) // raises an NPE => KO
{code}

Solution would be to accept empty string or null as values that remove the 
{{"comment"}} entry from the metadata, or create a new case 
{{TableChange.RemoveColumnComment}}.

  was:
The function {{TableChange.updateColumnComment}} can be used to add a comment 
to a column, change it, but not remove the comment entry from the column's 
metadata.

Moreover, trying to update the column with value {{null}} risks raising a NPE 
if the function {{TableChange.UpdateColumnComment.equals}} is called.

Examples in Scala:
{code:scala}
TableChange.updateColumnComment(Array("foo"), "foo comment") // adds or changes 
comment => OK
TableChange.updateColumnComment(Array("foo"), "") // adds or changes comment to 
empty string, instead of removing comment from metadata => KO
TableChange.updateColumnComment(Array("foo"), null) // adds or changes comment 
to null, instead of removing comment from metadata => KO
TableChange.updateColumnComment(Array("foo"), "foo comment") == 
TableChange.updateColumnComment(Array("foo"), null) // raises an NPE => KO
{code}

Solution would be to accept empty string or null as values that remove the 
{{"comment"}} entry from the metadata, or create a new case 
{{TableChange.removeColumnComment}}.


> TableChange.updateColumnComment does not remove comment entry
> -------------------------------------------------------------
>
>                 Key: SPARK-48130
>                 URL: https://issues.apache.org/jira/browse/SPARK-48130
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 3.4.1
>            Reporter: Patrick Grandjean
>            Priority: Major
>
> The function {{TableChange.updateColumnComment}} can be used to add a comment 
> to a column, change it, but not remove the comment entry from the column's 
> metadata.
> Moreover, trying to update the column with value {{null}} risks raising a NPE 
> if the function {{TableChange.UpdateColumnComment.equals}} is called.
> Examples in Scala:
> {code:scala}
> TableChange.updateColumnComment(Array("foo"), "foo comment") // adds or 
> changes comment => OK
> TableChange.updateColumnComment(Array("foo"), "") // adds or changes comment 
> to empty string, instead of removing comment from metadata => KO
> TableChange.updateColumnComment(Array("foo"), null) // adds or changes 
> comment to null, instead of removing comment from metadata => KO
> TableChange.updateColumnComment(Array("foo"), "foo comment") == 
> TableChange.updateColumnComment(Array("foo"), null) // raises an NPE => KO
> {code}
> Solution would be to accept empty string or null as values that remove the 
> {{"comment"}} entry from the metadata, or create a new case 
> {{TableChange.RemoveColumnComment}}.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to