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

Aitozi commented on FLINK-32249:
--------------------------------

It does not reproduce in my local sql client


{code:java}
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 create table s1;
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|                                                                               
                                                                                
                                                                                
                                               result |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| CREATE TABLE `default_catalog`.`default_database`.`s1` (
  `order_id` VARCHAR(2147483647) COMMENT '测试中文',
  `price` DECIMAL(32, 2) COMMENT '测试_utf8中文',
  `currency` VARCHAR(2147483647),
  `order_time` TIMESTAMP(3)
) COMMENT '测试中文table comment'
WITH (
  'connector' = 'dategen'
)
 |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set

Flink SQL> desc s1;
+------------+----------------+------+-----+--------+-----------+---------------+
|       name |           type | null | key | extras | watermark |       comment 
|
+------------+----------------+------+-----+--------+-----------+---------------+
|   order_id |         STRING | TRUE |     |        |           |      测试中文 |
|      price | DECIMAL(32, 2) | TRUE |     |        |           | 测试_utf8中文 |
|   currency |         STRING | TRUE |     |        |           |               
|
| order_time |   TIMESTAMP(3) | TRUE |     |        |           |               
|
+------------+----------------+------+-----+--------+-----------+---------------+
4 rows in set

Flink SQL> 

{code}




> A Java string should be used instead of a Calcite NlsString to construct the 
> table and column comment attributes 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
>            Priority: Major
>             Fix For: 1.18.0
>
>
> 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)

Reply via email to