flatten

Type of operation: Semistructured

Description

Given an input of object or array type, recursively flatten all child elements into ‘_c_NAME_path’ and ‘_c_NAME_value’ columns, generating null values for intermediate object/array values. The default is to not suggest column types (‘suggesttypes’ = ‘false’.) See also flatten_single.

Usage

flatten pathexpression [ , suggesttypes ]

Argument

Type

Required

Multiple

pathexpression

fieldref

Required

Only one

suggesttypes

bool

Optional

Only one

Accelerable

flatten is always accelerable if the input is accelerable. A dataset that only uses accelerable verbs can be accelerated, making queries on the dataset respond faster.

Examples

flatten foo

Produce new columns that contain every possible path and its corresponding value, with null values for intermediate key paths so the full tree is returned. Column ‘foo’ will be removed.

flatten foo, true

Produce new columns that contain every possible path and its corresponding value. It will also attempt to determine the value’s type, creating a third column, ‘_c_foo_type’, containing the name of the identified type. Column ‘foo’ will be removed.