Flatten Record directive

The FLATTEN-RECORD directive was introduced in CDAP 6.7.0.

The FLATTEN-RECORD directive splits a record column with nested values into multiple columns. To flatten an array, use the FLATTEN directive.

Syntax

flatten-record :column [,:column]*

The column is the name of a record column with nested values.

Usage

The directive takes multiple columns of type "Row" and brings all its elements up a level. Topmost elements will be set under new columns prefixed with the name of the parent column followed by an underscore. Existing columns with the same name will be replaced by the new values.

Example

Directive:

flatten-record :A

The record in column A is flattened.

Input Record:

| A | {B: 1, C: 2}

Output Record:

| A | A_B | A_C | {B: 1, C:2} | 1 | 2 |

 

Created in 2020 by Google Inc.