trilogy-data / trilogy-data/pytrilogy
Unnest Improvements
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 61
- Forks
- 3
- Avg merge
- 7h 18m
- Merged PRs (30d)
- 43
Description
Problem Statement
Handing of the output of an unnest is unclear currently, because it's assumed to come out to the grain of the unnest value, but that may not be unique.
Proposed Solution
We can rationalize different handling by having unnest output a struct of the form value, index - for example in duckdb by including generate_subscripts(l, 1) AS index - and assigning the unnest value as a property of the index.
This would enable someone to do select sum(unnest(x)) properly and count properly.
Alternatives Considered
Please briefly describe which alternatives, if any, have been considered, including merits of alternate approaches and
tradeoffs being made.
Additional Context
Please provide any other information that may be relevant.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files, tests, or entry points are named. Start by locating the existing unnest handling and its tests, then compare the current grain and aggregation behavior with the proposed value-and-index semantics. Done means the behavior is specified clearly and sum and count over unnest results work consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, sql
- Domain
- data, databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100