如果我有这种结构的Spark模式,
root
|-- id: long (nullable = true)
|-- firstname: string (nullable = true)
|-- lastname: string (nullable = true)
|-- orders: array (nullable = true)
| |-- element: struct (containsNull = true)
| | |-- id: long (nullable = true)
| | |-- price: double (nullable = true)
| | |-- userid: long (nullable = true)
如何用这个模式创建一个表,我试着用这个查询,
CREATE TABLE iceberg.test.order (
id BIGINT,
firstName VARCHAR,
lastName VARCHAR,
orders ROW(
id BIGINT,
price double,
userid BIGINT
)
)
WITH (
format = 'PARQUET'
)
1条答案
按热度按时间v2g6jxz61#
如果要创建表。要读取s3上现有的Parquet文件,语法如下例所示。我将它改编为您正在显示的模式:orders是一个struct数组。
以下是更多示例:https://aws.amazon.com/blogs/big-data/create-tables-in-amazon-athena-from-nested-json-and-mappings-using-jsonserde/