enhancementgood first issuestreaming-engine
Repository-Metriken
- Stars
- (5.739 Stars)
- PR-Merge-Metriken
- (Durchschn. Merge 4T 20h) (6 gemergte PRs in 30 T)
Beschreibung
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.