-
Notifications
You must be signed in to change notification settings - Fork 71
Aggregator implementation rework #1078
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
Conversation
6d24729
to
756473e
Compare
mean
# Conflicts: # core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/aggregation/aggregators/Aggregators.kt
… orNull overloads for each mean function. Added specific overloads for each primitive type -> Double(?) and big number -> BigDecimal(?)
f3327d6
to
3ea0167
Compare
…e value instance checks where we know the types already
mean
93bd243
to
d91930e
Compare
…n on primitives only
ab976a7
to
851b1a6
Compare
# Conflicts: # core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/max.kt # core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/median.kt # core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/min.kt # core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/max.kt # core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/median.kt # core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/min.kt
bfe2d90
to
868b8a1
Compare
dataframe-csv/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/io/readTsv.kt
Show resolved
Hide resolved
...nerated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/documentation/DelimParams.kt
Show resolved
Hide resolved
core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/api/statistics.kt
Outdated
Show resolved
Hide resolved
core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/math/sum.kt
Outdated
Show resolved
Hide resolved
core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/math/std.kt
Outdated
Show resolved
Hide resolved
.../src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/aggregation/aggregators/Aggregators.kt
Show resolved
Hide resolved
.../src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/aggregation/aggregators/Aggregators.kt
Show resolved
Hide resolved
...otlin/org/jetbrains/kotlinx/dataframe/impl/aggregation/aggregators/AggregatorOptionSwitch.kt
Show resolved
Hide resolved
core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/aggregation/aggregators/Aggregator.kt
Show resolved
Hide resolved
*/ | ||
internal interface UnifyingNumbers { | ||
|
||
/** | ||
* ``` | ||
* BigDecimal | ||
* (BigDecimal) |
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.
Will it be removed in the next PRs and will you keep the DAG after removal?
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.
JSON can still create Big numbers and maybe other places where number unification needs to happen can do it. It's only in statistics where we don't want big numbers, right?
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.
and yes, the DAG is still used to unify numbers before aggregating them with a statistics function. That way the statistics functions don't have to deal with mixed number types.
# Conflicts: # core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/api/statistics.kt
…. It's unneeded as we can calculate return types at runtime quickly. Added overload for calculateReturnTypeOrNull for multiple columns. Aggregator callers now use this function instead of `preservesType`
# Conflicts: # core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/api/statistics.kt
Helps #961
Aggregator improvements
UnifiedNumberTypeOptions
such that aggregators can choose to not work with big numberspreservesTypes
not always being honoredpreservesTypes
removed since it can usecalculateReturnTypeOrNull
calculateReturnTypeOrNull
function that needs to be supplied for each aggregator. Often it's as simple as{ _, _ -> typeOf<Double>() }
but it can reduce runtime value checks equal to the number of columns. These functions might be reused by the compiler plugin btw ;)aggregateMixed
aggregateCalculatingType
. Often used in row-functions. It's unnecessary to do runtime reflection since we know the type of each cell in the row after all.Renamed
interComparableColumns
tointra-
, because that's what it actually does. ("inter" would mean "in between columns", "intra" means "inside a column")