BigQuery now supports the RANGE Data Type for JSON

Using the Range Data Type with JSON Encoding

Christianlauer
CodeX

--

Photo by Bob Brewer on Unsplash

When working with Big Data in BigQuery a JSON encoding is often the way to go. Now it’s also supports the RANGE data type[1].

A JSON encoding is often a very good approach when working with unstructured or semi structured (big) data. If you haven’t try it in BigQuery — this article can help you out:

A few months ago Google also launched the Range data type for BigQuery. The range represents the temporal validity of a row, providing the start and end time for which the row is valid. GoogleSQL for BigQuery supports the following range functions[2]:

Range Function — Image Source: Google[4]

To illustrate this I have the following small example for you:

SELECT GENERATE_RANGE_ARRAY(
RANGE(DATE ‘2020–01–01’, DATE ‘2020–01–06’),
INTERVAL 1 DAY) AS results;

--

--

Christianlauer
CodeX

Big Data Enthusiast based in Hamburg and Kiel. Thankful if you would support my writing via: https://christianlauer90.medium.com/membership