You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "lincoln lee (Jira)" <ji...@apache.org> on 2023/06/05 03:11:00 UTC
[jira] [Updated] (FLINK-32249) A Java string should be used instead of a Calcite NlsString to construct the table and column comment attributes of CatalogTable
[ https://issues.apache.org/jira/browse/FLINK-32249?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
lincoln lee updated FLINK-32249:
--------------------------------
Description:
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}
was:
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]
> 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)