Redshift Spectrum 在创建嵌套数据时出现语法错误

Redshift Spectrum gives syntax error on creating nested data

我正在使用这个查询

CREATE EXTERNAL TABLE test.post(
      edge_media_to_tagged_user struct<
            "edges": array<
            "node": struct<
                "user": struct<
                  id:bigint,
                  username:text
                >,
                x: float(24),
                y: float(24)
            >
        >
      >
  )
ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe'
LOCATION 's3://bucket/test';

上面的查询不知何故给了我

ERROR:  syntax error at or near ":"
LINE 4:             "node": struct<

删除或添加冒号 and/or 双引号仍然给我错误。

感谢任何帮助!

不幸的是,Redshift 不支持结构数据类型。可以找到 Redshift 支持的完整数据类型列表 here

编辑:正常 Redshift 不支持结构。 Redshift Spectrum 确实如此。

我想这可能是由这个位引起的:

        "edges": array<
        "node": struct<

数组不包含命名项,因此当它在 array 定义中发现 "node": 时可能会失败。

给出重要提示,这段代码有效


CREATE EXTERNAL TABLE likes_schema_test.post88(
      edge_media_to_tagged_user struct<
        "edges": array<struct<      <-- change here
            "node": struct<
                "user": struct<
                  full_name:text,
                  id:bigint,
                  is_verified: boolean,
                  username:text
                >,
                x: float(24),
                y: float(24)
            >>
        >
      >
  )
ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe'
LOCATION 's3://follower-dumper-testing/post_test';

"node" 更改为 'node' 会出现语法错误。