Arrays in BigQuery

Create an Array

create table test_dataset_av.test_dataset_av as 

WITH
a as (
  select ('first','second', 'third') as sequence_num
)
select a.sequence_num from a

Create a dataset

CREATE SCHEMA my-sandbox.test_dataset_av

  OPTIONS (

    default_kms_key_name = 'KMS_KEY_NAME',

    default_partition_expiration_days = PARTITION_EXPIRATION,

    default_table_expiration_days = TABLE_EXPIRATION,

    description = 'test_billing_queries',

    labels = [('test1','VALUE_1'),('test2','VALUE_2')],

    location = 'us-central1',

    max_time_travel_hours = HOURS,

    storage_billing_model = STORAGE_BILLING_MODEL);

How to tell if a data type is an Array?

create table dataset_test.test_array as 

WITH

a as (

  select ('first','second', 'third') as sequence_num

)

select a.sequence_num from a

Summary

Arrays and Structs are an important part of any data analytics platform. This post discusses array basics in BigQuery.

 

Need an experienced Cloud Professional to help out with your Public Cloud Strategy? Set up a time with Anuj Varma.