[
https://issues.apache.org/jira/browse/FLINK-32249?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17729536#comment-17729536
]
lincoln lee commented on FLINK-32249:
-------------------------------------
fixed in 1.17: 7c2631b8ba8c935be03c91fd44b7aa42937a9698
> A Java string should be used instead of a Calcite NlsString to construct the
> column comment of CatalogTable
> -----------------------------------------------------------------------------------------------------------
>
> Key: FLINK-32249
> URL: https://issues.apache.org/jira/browse/FLINK-32249
> Project: Flink
> Issue Type: Bug
> Components: Table SQL / Planner
> Affects Versions: 1.17.1
> Reporter: lincoln lee
> Assignee: lincoln lee
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.17.2
>
> Attachments: 1.17-problematic-to-string.png, 1.18-proper-to-string.png
>
>
> when Flink interacts with CatalogTable, it directly passes the Calcite's
> NlsString comment as a string to the comment attribute of the schema and
> column. In theory, a Java string should be passed here, otherwise the
> CatalogTable implementers may encounter special character encoding issues,
> e.g., an issue in apache paimon:
> [https://github.com/apache/incubator-paimon/issues/1262]
> also tested in sql-client:
> {code}
> Flink SQL> CREATE TABLE s1 (
> > order_id STRING comment '测试中文',
> > price DECIMAL(32,2) comment _utf8'测试_utf8中文',
> > currency STRING,
> > order_time TIMESTAMP(3)
> > ) comment '测试中文table comment' WITH ('connector'='dategen');
> [INFO] Execute statement succeed.
> Flink SQL> show tables;
> +------------+
> | table name |
> +------------+
> | s1 |
> +------------+
> 1 row in set
> Flink SQL> desc s1;
> +------------+----------------+------+-----+--------+-----------+-------------------------+
> | name | type | null | key | extras | watermark |
> comment |
> +------------+----------------+------+-----+--------+-----------+-------------------------+
> | order_id | STRING | TRUE | | | |
> u&'\6d4b\8bd5\4e2d\6587 |
> | price | DECIMAL(32, 2) | TRUE | | | |
> _UTF8'测试_utf8中文 |
> | currency | STRING | TRUE | | | |
> |
> | order_time | TIMESTAMP(3) | TRUE | | | |
> |
> +------------+----------------+------+-----+--------+-----------+-------------------------+
> 4 rows in set
> Flink SQL> show create table s1;
> +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
> |
>
>
> result |
> +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
> | CREATE TABLE `default_catalog`.`default_database`.`s1` (
> `order_id` VARCHAR(2147483647),
> `price` DECIMAL(32, 2),
> `currency` VARCHAR(2147483647),
> `order_time` TIMESTAMP(3)
> ) COMMENT '测试中文table comment'
> WITH (
> 'connector' = 'dategen'
> )
> |
> +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
> 1 row in set
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)