Aggregation with collectSet on empty dataset produces Null
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- scala, spark
- Domain
- data-engineering
Research direction
Start by reproducing the empty TypedDataset example with collectSet combined with min, then inspect the collectSet aggregation implementation and related tests. Done means empty input returns WrappedArray() both alone and when combined with another aggregation, without changing the behavior of non-empty inputs.
Written by the indexing model from the issue text.
Description
Consider the following example:
import frameless.functions.aggregate.{collectSet, max, min}
import frameless.syntax._
import frameless.TypedDataset
case class Foo(bar: Int)
val ds = TypedDataset.create(List.empty[Foo])
ds
.agg(
min(ds('bar)),
collectSet(ds('bar))
)
.collect
.run
It produces WrappedArray(null) while the expected value would be WrappedArray() because the initial dataset is empty.
Please note that this bug happen only when collectSet is combined with an other aggregation. Aggregating only with min produces the expected result.
While using only collectSet
ds.agg(collectSet(ds('bar))).collect.run
Produces WrappedArray(Vector()) while the expected value is WrappedArray()
I haven't tested with the other collect functions llke collectList
- Dominant language
- Scala
- Stars
- 895
- Forks
- 135
- Avg merge
- 7h 38m
- Merged PRs (30d)
- 1
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing 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.
More from typelevel/frameless
-
Scala 3 buildsOpenenhancement feature help wanted
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
enhancement feature
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
All issues in typelevel/frameless
Similar issues
-
bug performance priority:medium regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
apache/datafusion-comet#6313 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
com-lihaoyi/mill#7624 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
lichess-org/lila#21845 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day