apache / incubator-streampark

Make stream processing easier! Easy-to-use streaming application development framework and operation platform.
https://streampark.apache.org/
Apache License 2.0
3.84k stars 990 forks source link

If you write the value of a field in Chinese in flink sql, garbled characters appear #3491

Open weiguang660 opened 7 months ago

weiguang660 commented 7 months ago

Search before asking

Java Version

No response

Scala Version

2.11.x

StreamPark Version

2.1.1

Flink Version

1.15.3

deploy mode

None

What happened

If you write the value of a field in Chinese in flink sql, garbled characters appear (在flink sql中写死某个字段的值为中文,会乱码)

Error Exception

1.Flink SQL:
CREATE TABLE datagen (
    f_sequence INT,
    f_random INT,
    f_random_str STRING,
    ts AS localtimestamp,
    WATERMARK FOR ts AS ts
  ) WITH (
    'connector' = 'datagen',
    -- optional options测试 --
    'rows-per-second'='5',
    'fields.f_sequence.kind'='sequence',
    'fields.f_sequence.start'='1',
    'fields.f_sequence.end'='500',
    'fields.f_random.min'='1',
    'fields.f_random.max'='500',
    'fields.f_random_str.length'='10'
  );

  CREATE TABLE print_table (
    f_sequence INT,
    f_random INT,
    f_random_str STRING,
    test_field STRING
    ) WITH (
    'connector' = 'print'
  );

  INSERT INTO print_table select f_sequence,f_random,f_random_str,'测试' from datagen;

2.output:
[38, 313, 7ca456f4da, ??????]

3.Job Manager:
CREATE TABLE datagen (
    f_sequence INT,
    f_random INT,
    f_random_str STRING,
    ts AS localtimestamp,
    WATERMARK FOR ts AS ts
  ) WITH (
    'connector' = 'datagen',
    -- optional options?????? --
    'rows-per-second'='5',
    'fields.f_sequence.kind'='sequence',
    'fields.f_sequence.start'='1',
    'fields.f_sequence.end'='500',
    'fields.f_random.min'='1',
    'fields.f_random.max'='500',
    'fields.f_random_str.length'='10'
  );

  CREATE TABLE print_table (
    f_sequence INT,
    f_random INT,
    f_random_str STRING,
    test_field STRING
    ) WITH (
    'connector' = 'print'
  );

  INSERT INTO print_table select f_sequence,f_random,f_random_str,'??????' from datagen;

Screenshots

No response

Are you willing to submit PR?

Code of Conduct

skyoct commented 7 months ago

@caicancai I want to give it a try

caicancai commented 7 months ago

@caicancai I want to give it a try

Cool. Looking forward to your PR

weiguang660 commented 6 months ago

Has this issue been resolved?