Aggregation with collectSet on empty dataset produces Null
ayoub-benali opened this issue · 0 comments
ayoub-benali commented
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