【问题标题】:How to define nested array to ingest data and convert?如何定义嵌套数组来摄取数据并进行转换?
【发布时间】:2020-03-05 05:09:32
【问题描述】:

我正在使用 Firehose 和 Glue 来摄取数据并将 JSON 转换为 S3 中的 parquet 文件。

我成功地使用普通 JSON(不是嵌套或数组)实现了它。但是我对嵌套的 JSON 数组失败了。我做了什么:

JSON 结构

{
    "class_id": "test0001",
    "students": [{
        "student_id": "xxxx",
        "student_name": "AAAABBBCCC",
        "student_gpa": 123
    }]
}

胶水模式

  1. class_id:字符串
  2. 学生:数组ARRAY<STRUCT<student_id:STRING,student_name:STRING,student_gpa:INT>>

我收到错误:

The schema is invalid. Error parsing the schema: Error: type expected at the position 0 of 'ARRAY<STRUCT<student_id:STRING,student_name:STRING,student_gpa:INT>>' but 'ARRAY' is found.

欢迎提出任何建议。

【问题讨论】:

标签: json amazon-web-services parquet aws-glue amazon-kinesis-firehose


【解决方案1】:

我遇到了这个问题,因为我在 AWS 控制台中手动创建了架构。问题是,它会在表单旁边显示一些帮助文本以输入您的嵌套数据,这些数据将所有内容都大写,但 Parquet 只能使用 lowercase 定义。

不顾 AWS 给出的例子写:

array<struct<student_id:string,student_name:string,student_gpa:int>>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-11-23
    • 2019-03-21
    • 1970-01-01
    • 2018-08-29
    • 1970-01-01
    • 1970-01-01
    • 2021-11-21
    • 2018-05-15
    相关资源
    最近更新 更多