简体   繁体   English

如何在BigQuery中为arrays的arrays创建DDL

[英]How to create DDL for arrays of arrays in BigQuery

I am trying to create a table definition in BigQuery which can be used to insert records containing array of arrays我正在尝试在 BigQuery 中创建一个表定义,它可用于插入包含 arrays 数组的记录

sample data for array of arrays: [["1","2","3","4"],["1","2","3","4"],["1","2","3","4"]] arrays 数组的样本数据: [["1","2","3","4"],["1","2","3","4"],["1","2","3","4"]]

I tried following -我试过以下 -

CREATE TABLE IF NOT EXISTS dataset.test1 (
  a String,
  b STRUCT <STRUCT <c ARRAY <ARRAY <STRING>>>>
)

But getting following error: Array of arrays are not supported但出现以下错误:不支持 arrays 数组

How do I create a table structure for array of arrays records?如何为 arrays 条记录的数组创建表结构?

Array of array is not supported, the best that you can do is to have outer ARRAY of a STRUCT, then the STRUCT has an inner array field, try this SQL:不支持数组的数组,你能做的最好的是有结构的外部数组,然后结构有一个内部数组字段,试试这个 SQL:

create table yourDataset.t (arrayOfArray ARRAY< STRUCT< arr ARRAY<STRING> > >)
AS SELECT  [Struct<ARRAY<STRING>>(["1","2","3","4"]),
            Struct<ARRAY<STRING>>(["1","2","3","4"]),
            Struct<ARRAY<STRING>>(["1","2","3","4"])];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM