Skip to content

flink sql insert iceberg table array, then select the table array values is same. #4924

@chixiaopao

Description

@chixiaopao

flink version: 1.14.4
iceberg version: 0.13.1
idea test use hadoop catalog.
example:

env.executeSql(
      s"""
         |CREATE CATALOG `$catalog` WITH (
         |  'type'='iceberg',
         |  'catalog-type'='hadoop',
         |  'warehouse'='$basePath',
         |  'property-version'='1'
         |)
         |""".stripMargin
    )

    env.useCatalog(catalog)
    env.useDatabase(database)

create table :

env.executeSql(
      s"""
         |CREATE TABLE IF NOT EXISTS `$catalog`.`$database`.`test`
         |(
         |    `dateId`                        STRING COMMENT '分区时间',
         |    `tagGcode`                      ARRAY<STRING> COMMENT '标签gcode列表',
         |    `windowsTagIds`                 ARRAY<STRING> COMMENT '窗口标签ID列表',
         |    `windowTag`                     STRING COMMENT '窗口标签',
         |    `create_time`                   TIMESTAMP COMMENT '数据创建时间'
         |)  PARTITIONED BY (dateId)
         |WITH (
         | 'format-version' = '2',
         | 'write.upsert.enabled' = 'false',
         | 'write.distribution-mode' = 'hash',
         | 'write.metadata.delete-after-commit.enabled' = 'true',
         | 'write.parquet.row-group-size-bytes' = '134217728',
         | 'write.target-file-size-bytes' = '536870912',
         | 'history.expire.max-snapshot-age-ms' = '360000',
         | 'write.metadata.previous-versions-max' = '5',
         | 'write.parallelism' = '1'
         |)
         |""".stripMargin
    )

insert data:

env.executeSql(
      s"""
         |INSERT INTO `$catalog`.`$database`.`test` VALUES(
         |'2022-05-31',
         |Array['gcode'],
         |Array['window_tag_id'],
         |'window_tag',
         |to_timestamp('2022-05-31 18:00:00')
         |)
         |""".stripMargin
    )

select:

env
      .executeSql(
        s"""
           |select tagGcode, windowsTagIds
           |from `$catalog`.`$database`.`test`
           |where dateId >= '2022-05-29' and dateId < '2022-06-01'
           |""".stripMargin).print()

result:

+--------------------------------+--------------------------------+
|                       tagGcode |                  windowsTagIds |
+--------------------------------+--------------------------------+
|                        [gcode] |                        [gcode] |
+--------------------------------+--------------------------------+

why? is this bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions