よく見えます。ちょうどあなたのための別の可能性として、あなたもそうのように、ARRAY
(繰り返しフィールド)の内部で別のSTRUCT
(レコード)として、それぞれの新しい解像度を保存することができます:
:その結果
WITH data AS(
select 'APPL' as symbol, ARRAY<STRUCT<date string, time string, resolution INT64, open FLOAT64, high FLOAT64, low FLOAT64, close FLOAT64>> [STRUCT('2017-06-19' as date, '9:30' as time, 5 as resolution, 99.12 as open, 102.52 as high, 94.22 as low, 98.32 as close), STRUCT('2017-06-19' as date, '9:30' as time, 1 as resolution, 99.12 as open, 100.11 as high, 99.01 as low, 100.34 as close)] stock union all
select 'IBM' as symbol, ARRAY<STRUCT<date string, time string, resolution INT64, open FLOAT64, high FLOAT64, low FLOAT64, close FLOAT64>> [STRUCT('2017-06-19' as date, '9:30' as time, 5 as resolution, 40.15 as open, 45.78 as high, 39.18 as low, 44.22 as close)]
)
SELECT * FROM data
解決のために新しい値を保存すると、各在庫に対して定義されたARRAYに別の行が追加されます。
また、これと同様に日付レベル上のアレイを集約することができますになり
WITH data AS(
select 'APPL' as symbol, STRUCT<date string, time string, hit ARRAY<STRUCT<resolution INT64, open FLOAT64, high FLOAT64, low FLOAT64, close FLOAT64>>> ('2017-06-19', '9:30', [STRUCT(1 as resolution, 99.12 as open, 102.52 as high, 94.22 as low, 98.32 as close), STRUCT(5 as resolution, 99.12 as open, 100.11 as high, 99.01 as low, 100.34 as close)]) stock union all
select 'IBM' as symbol, STRUCT<date string, time string, hit ARRAY<STRUCT<resolution INT64, open FLOAT64, high FLOAT64, low FLOAT64, close FLOAT64>>> ('2017-06-19', '9:30', [STRUCT(1 as resolution, 40.15 as open, 45.78 as high, 39.18 as low, 44.22 as close)])
)
SELECT * FROM data
:
は、スキーマのこのタイプはどのくらいに応じて、あなたにいくつかの利点を与えるかもしれませんより安価でより効果的なストレージや高速なクエリなど、処理しているデータがある場合があります(Resources Exceeded
エラーを返すクエリとそれが正常に動作するクエリの違いが0123の賢明な使用法であることがあります)。