enhancementgood first issuestreaming-engine
描述
Is your feature request related to a problem? Please describe.
A user requested the ability to map an array into fields where the arrays have some predefined set of values:
Sample Data:
- FOO: [{"key":"a", "val":2}, {"key":"b", "val":4}]
- FOO: [{"key":"b", "val":3}]
Sample Output:
| a | b |
|---|---|
| 2 | 4 |
|nul| 3 |
Describe the solution you'd like
We could implement FIND_FIRST(array, x -> predicate(x)) lambda function and implement this as:
SELECT FIND_FIRST(FOO, x -> x = 'a') AS a, FIND_FIRST(FOO, x -> x = 'b') AS b FROM source;
Describe alternatives you've considered
Implement PIVOT - this is a little bit more involved and this is a good general use case for lambdas.