flatten_all¶
Type of operation: Semistructured
Description¶
Given an object or array input, recursively flatten all child and intermediate elements into key-value columns.
The key and value child and intermediate element columns are named ‘c_NAME_path’ and ‘_c_NAME_value’. NAME is replaced with the original column name.
Flatten_all is a more expensive operation than flatten_leaves or flatten_single. The default is to not suggest column types (‘suggesttypes’ = ‘false’.) See also flatten, flatten_leaves, and flatten_single.
Usage¶
flatten_all pathexpression, [ suggesttypes ]
| Argument | Type | Optional | Repeatable | Restrictions | 
|---|---|---|---|---|
| pathexpression | array or object | no | no | column | 
| suggesttypes | bool | yes | no | none | 
Accelerable¶
flatten_all 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_all foo
Given this JSON in column foo:
| foo | 
|---|
| 
 | 
flatten_all produces:
| _c_foo_path | _c_foo_value | 
|---|---|
| 
 | 3 | 
| 
 | 1 | 
| 
 | 2 | 
| 
 | 
 | 
| 
 | 
 | 
| 
 | 
 | 
| 
 | 
 | 
| 
 | 
 | 
It recurses the JSON object and produces new columns that contain every possible path and its corresponding value. Column ‘foo’ will be removed.
flatten_all foo, true
Given this JSON in column foo:
| foo | 
|---|
| 
 | 
flatten_all produces:
| _c_foo_path | _c_foo_value | _c_foo_type | 
|---|---|---|
| 
 | 3 | int64 | 
| 
 | 1 | int64 | 
| 
 | 2 | int64 | 
| 
 | 
 | object | 
| 
 | 
 | object | 
| 
 | 
 | object | 
| 
 | 
 | object | 
| 
 | 
 | array | 
It recurses the JSON object and produces new columns that contain every possible path and its corresponding value. It will also attempt to determine the value’s type, creating a third (hidden) column named ‘_c_foo_type’. Column ‘foo’ will be removed.
Aliases¶
- flattenall(deprecated)