Skip to content

Commit 2fbf725

Browse files
Automated commit of generated code
1 parent b319f73 commit 2fbf725

File tree

6 files changed

+2
-35
lines changed

6 files changed

+2
-35
lines changed

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/aggregation/aggregators/inputHandlers/NumberInputHandler.kt

-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.jetbrains.kotlinx.dataframe.impl.aggregation.aggregators.inputHandlers
22

3-
import io.github.oshai.kotlinlogging.KotlinLogging
43
import org.jetbrains.kotlinx.dataframe.documentation.UnifyingNumbers
54
import org.jetbrains.kotlinx.dataframe.impl.UnifiedNumberTypeOptions
65
import org.jetbrains.kotlinx.dataframe.impl.aggregation.aggregators.Aggregator
@@ -22,8 +21,6 @@ import kotlin.reflect.full.isSubtypeOf
2221
import kotlin.reflect.full.withNullability
2322
import kotlin.reflect.typeOf
2423

25-
private val logger = KotlinLogging.logger { }
26-
2724
/**
2825
* Input handler for aggregators that can handle any (mixed) primitive [Number] type of input.
2926
*
@@ -107,14 +104,6 @@ internal class NumberInputHandler<out Return : Any?> : AggregatorInputHandler<Nu
107104
override fun calculateValueType(valueTypes: Set<KType>): ValueType {
108105
val unifiedType = valueTypes.unifiedNumberTypeOrNull(UnifiedNumberTypeOptions.PRIMITIVES_ONLY)
109106
?: typeOf<Number>().withNullability(valueTypes.any { it.isMarkedNullable })
110-
111-
if (unifiedType.isSubtypeOf(typeOf<Double?>()) &&
112-
(typeOf<ULong>() in valueTypes || typeOf<Long>() in valueTypes)
113-
) {
114-
logger.warn {
115-
"Number unification of Long -> Double happened during ${aggregator!!.name} aggregation. Loss of precision may have occurred."
116-
}
117-
}
118107
if (!unifiedType.isPrimitiveOrMixedNumber() && !unifiedType.isNothing) {
119108
throw IllegalArgumentException(
120109
"Cannot calculate ${aggregator!!.name} of ${

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/math/mean.kt

-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.jetbrains.kotlinx.dataframe.math
22

3-
import io.github.oshai.kotlinlogging.KotlinLogging
43
import org.jetbrains.kotlinx.dataframe.api.skipNaNDefault
54
import org.jetbrains.kotlinx.dataframe.impl.aggregation.aggregators.CalculateReturnType
65
import org.jetbrains.kotlinx.dataframe.impl.nothingType
@@ -10,8 +9,6 @@ import java.math.BigInteger
109
import kotlin.reflect.KType
1110
import kotlin.reflect.typeOf
1211

13-
private val logger = KotlinLogging.logger { }
14-
1512
@Suppress("UNCHECKED_CAST")
1613
internal fun <T : Number> Sequence<T>.mean(type: KType, skipNaN: Boolean): Double {
1714
if (type.isMarkedNullable) {
@@ -29,7 +26,6 @@ internal fun <T : Number> Sequence<T>.mean(type: KType, skipNaN: Boolean): Doubl
2926
typeOf<Byte>() -> (this as Sequence<Byte>).map { it.toDouble() }.mean(false)
3027

3128
typeOf<Long>() -> {
32-
logger.warn { "Converting Longs to Doubles to calculate the mean, loss of precision may occur." }
3329
(this as Sequence<Long>).map { it.toDouble() }.mean(false)
3430
}
3531

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/math/median.kt

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.jetbrains.kotlinx.dataframe.math
22

3-
import io.github.oshai.kotlinlogging.KotlinLogging
43
import org.jetbrains.kotlinx.dataframe.api.isNaN
54
import org.jetbrains.kotlinx.dataframe.impl.aggregation.aggregators.CalculateReturnType
65
import org.jetbrains.kotlinx.dataframe.impl.canBeNaN
@@ -15,8 +14,6 @@ import kotlin.reflect.KType
1514
import kotlin.reflect.full.withNullability
1615
import kotlin.reflect.typeOf
1716

18-
private val logger = KotlinLogging.logger { }
19-
2017
/**
2118
* Returns the median of the comparable input:
2219
* - `null` if empty
@@ -48,8 +45,7 @@ internal fun <T : Comparable<T>> Sequence<T>.medianOrNull(type: KType, skipNaN:
4845
"Cannot calculate the median for big numbers in DataFrame. Only primitive numbers are supported.",
4946
)
5047

51-
type == typeOf<Long>() ->
52-
logger.warn { "Converting Longs to Doubles to calculate the median, loss of precision may occur." }
48+
// TODO kdocs: note about loss of precision for Long
5349
}
5450

5551
val p = 0.5

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/math/percentile.kt

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.jetbrains.kotlinx.dataframe.math
22

3-
import io.github.oshai.kotlinlogging.KotlinLogging
43
import org.jetbrains.kotlinx.dataframe.api.isNaN
54
import org.jetbrains.kotlinx.dataframe.impl.aggregation.aggregators.CalculateReturnType
65
import org.jetbrains.kotlinx.dataframe.impl.isIntraComparable
@@ -14,8 +13,6 @@ import kotlin.reflect.KType
1413
import kotlin.reflect.full.withNullability
1514
import kotlin.reflect.typeOf
1615

17-
private val logger = KotlinLogging.logger { }
18-
1916
/**
2017
* Uses [QuantileEstimationMethod.R8] for primitive numbers, else [QuantileEstimationMethod.R3]
2118
*/
@@ -41,8 +38,7 @@ internal fun <T : Comparable<T>> Sequence<T>.percentileOrNull(percentile: Double
4138
"Cannot calculate the percentile for big numbers in DataFrame. Only primitive numbers are supported.",
4239
)
4340

44-
type == typeOf<Long>() ->
45-
logger.warn { "Converting Longs to Doubles to calculate the percentile, loss of precision may occur." }
41+
// TODO kdocs: note about loss of precision for Long
4642
}
4743

4844
// percentile of 25.0 means the 25th 100-quantile, so 25 / 100 = 0.25

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/math/quantile.kt

-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.jetbrains.kotlinx.dataframe.math
22

3-
import io.github.oshai.kotlinlogging.KotlinLogging
43
import org.jetbrains.kotlinx.dataframe.api.isNaN
54
import org.jetbrains.kotlinx.dataframe.impl.canBeNaN
65
import org.jetbrains.kotlinx.dataframe.impl.isIntraComparable
@@ -16,8 +15,6 @@ import kotlin.reflect.KType
1615
import kotlin.reflect.full.withNullability
1716
import kotlin.reflect.typeOf
1817

19-
private val logger = KotlinLogging.logger { }
20-
2118
/**
2219
* Returns the p-quantile: the k'th q-quantile, where p = k/q.
2320
*
@@ -60,9 +57,6 @@ internal fun <T : Comparable<T>> Sequence<Any>.quantileOrNull(
6057
throw IllegalArgumentException(
6158
"Cannot calculate the $name for big numbers in DataFrame. Only primitive numbers are supported.",
6259
)
63-
64-
type == typeOf<Long>() ->
65-
logger.warn { "Converting Longs to Doubles to calculate the $name, loss of precision may occur." }
6660
}
6761

6862
// propagate NaN to return if they are not to be skipped

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/math/std.kt

-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.jetbrains.kotlinx.dataframe.math
22

3-
import io.github.oshai.kotlinlogging.KotlinLogging
43
import org.jetbrains.kotlinx.dataframe.api.ddofDefault
54
import org.jetbrains.kotlinx.dataframe.api.skipNaNDefault
65
import org.jetbrains.kotlinx.dataframe.impl.aggregation.aggregators.CalculateReturnType
@@ -12,8 +11,6 @@ import kotlin.math.sqrt
1211
import kotlin.reflect.KType
1312
import kotlin.reflect.typeOf
1413

15-
private val logger = KotlinLogging.logger { }
16-
1714
/**
1815
* Calculates the standard deviation from [this] with optional delta degrees of freedom.
1916
*
@@ -39,7 +36,6 @@ internal fun <T : Number> Sequence<T?>.std(type: KType, skipNaN: Boolean, ddof:
3936
typeOf<Byte>() -> (this as Sequence<Byte>).map { it.toDouble() }.std(false, ddof)
4037

4138
typeOf<Long>() -> {
42-
logger.warn { "Converting Longs to Doubles to calculate the std, loss of precision may occur." }
4339
(this as Sequence<Long>).map { it.toDouble() }.std(false, ddof)
4440
}
4541

0 commit comments

Comments
 (0)