Expand description
Define a plan for unnesting values in columns that contain a list type.
Structsยง
- List
Unnest - Unnest
Exec - Unnest the given columns (either with type struct or list) For list unnesting, each row is vertically transformed into multiple rows For struct unnesting, each column is horizontally transformed into multiple columns, Thus the original RecordBatch with dimension (n x m) may have new dimension (nโ x mโ)
- Unnest
Metrics ๐ - Unnest
Stream ๐ - A stream that issues [RecordBatch]es with unnested column data.
- Unnesting
Result ๐
Traitsยง
- List
Array ๐Type - Trait defining common methods used for unnesting, implemented by list array types.
Functionsยง
- build_
batch ๐ - For each row in a
RecordBatch, some list/struct columns need to be unnested. - create_
take_ ๐indices - Creates take indices that will be used to expand all columns except for the list type
columnsthat is being unnested. Every column value needs to be repeated multiple times according to the length array. - find_
longest_ ๐length - Find the longest list length among the given list arrays for each row.
- flatten_
struct_ ๐cols - Given a set of struct column indices to flatten try converting the column in input into multiple subfield columns For example struct_col: [a: struct(item: int, name: string), b: int] with a batch {a: {item: 1, name: โaโ}, b: 2}, {a: {item: 3, name: โbโ}, b: 4] will be converted into {a.item: 1, a.name: โaโ, b: 2}, {a.item: 3, a.name: โbโ, b: 4}
- list_
unnest_ ๐at_ level - This function is used to execute the unnesting on multiple columns all at once, but one level at a time, and is called n times, where n is the highest recursion level among the unnest exprs in the query.
- repeat_
arrs_ ๐from_ indices - Create a batch of arrays based on an input
batchand aindicesarray. Theindicesarray is used by the take kernel to repeat values in the arrays that are marked withtruein therepeat_mask. Arrays marked withfalsein therepeat_maskwill be replaced with arrays filled with nulls of the appropriate length. - unnest_
list_ ๐array - Unnest a list array according the target length array.
- unnest_
list_ ๐arrays - Unnest multiple list arrays according to the length array.