Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aggregation with collectSet on empty dataset produces Null #452

Open
ayoub-benali opened this issue Oct 23, 2020 · 0 comments
Open

Aggregation with collectSet on empty dataset produces Null #452

ayoub-benali opened this issue Oct 23, 2020 · 0 comments

Comments

@ayoub-benali
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant