-
Notifications
You must be signed in to change notification settings - Fork 66
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
GroupBy aggregate fix #803
Conversation
…rary column was created with nulls in a FrameColumn
…s into "" } would break typing
cb374a4
to
23046d8
Compare
Generated sources will be updated after merging this PR. |
is AggregateInternalDsl<*> -> yield(value.copy(value = value.value.df)) | ||
is AggregateInternalDsl<*> -> { | ||
// Attempt to create DataFrame<Type> from AggregateInternalDsl<Type> | ||
val dfType = value.type?.arguments?.firstOrNull()?.type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a little bit worried about this expression with 6 ? - what if something goes wrong and will be null, I could not explain myself the logic, should we handle the alternative (or common alternative)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's what the ?:
is for at the end. We try to create DataFrame<Type1>
from AggregateInternalDsl<Type1>
. However, in theory, any KType can be supplied by the user. KTypes like GroupByReceiverImpl<Type1>
, DataFrame<Type1>
(which would both still work), but unfortunately also KTypes like CompletelyCustomType
without arguments. So in cases where this type argument cannot be fetched, we default to DataFrame<*>
with the ?:
.
With the debug mode enabled, one failing test of #713 was in
GroupBy.aggregate { this into "" }
.I narrowed it down to a
NamedValue
being created inGroupByReceiverImpl
with KTypeAggregateGroupedDsl<DfType>
. Since this value is anAggregateInternalDsl<*>
too, it is unpacked in theyield()
function to get the underlying dataframe (by copying theNamedValue
and replacing itsvalue
with itsvalue.df
), however, the KType of thisNamedValue
was left unchanged and thus mismatched the value.This PR fixes that by updating that KType value too