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

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

我成功使用普通的JSON(非嵌套或数组)实现了它。但是我无法使用嵌套的JSON数组。我所做的:

JSON结构

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

Glue模式

  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_gpa:INT>>' but 'ARRAY' is found.

任何建议都值得赞赏。

hanzilou 回答:如何定义嵌套数组以提取数据并进行转换?

之所以遇到这种情况,是因为我在AWS控制台中手动创建了架构。问题在于,它会在表单旁边显示一些帮助文本,以输入嵌套数据以大写所有内容,但Parquet仅适用于小写定义。

尽管有AWS给出的示例,也要写:

array<struct<student_id:string,student_name:string,student_gpa:int>>
本文链接:https://www.f2er.com/3137115.html

大家都在问