如何定义嵌套数组以摄取数据并进行转换?

fra*_*ong 7 json amazon-web-services parquet aws-glue amazon-kinesis-firehose

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

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

JSON 结构

{
    "class_id": "test0001",
    "students": [{
        "student_id": "xxxx",
        "student_name": "AAAABBBCCC",
        "student_gpa": 123
    }]
}
Run Code Online (Sandbox Code Playgroud)

胶水模式

  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.
Run Code Online (Sandbox Code Playgroud)

任何建议表示赞赏。

ben*_*ben 6

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

尽管 AWS 给出的例子写:

array<struct<student_id:string,student_name:string,student_gpa:int>>
Run Code Online (Sandbox Code Playgroud)