-
Notifications
You must be signed in to change notification settings - Fork 75
describe()
fixes
#937
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
describe()
fixes
#937
Changes from 16 commits
6b4e9d0
c97a973
6e028f1
ba00f0f
4d4ebda
2ef56b4
ac3eb9a
563d367
966447d
63ee929
b2bdb4a
05e0993
c8de339
860ea39
ea4d035
b64791f
8889e13
36fd883
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,11 @@ import org.jetbrains.kotlinx.dataframe.impl.isNothing | |
import org.jetbrains.kotlinx.dataframe.impl.projectTo | ||
import org.jetbrains.kotlinx.dataframe.type | ||
import org.jetbrains.kotlinx.dataframe.typeClass | ||
import org.jetbrains.kotlinx.dataframe.util.IS_COMPARABLE | ||
import org.jetbrains.kotlinx.dataframe.util.IS_COMPARABLE_REPLACE | ||
import org.jetbrains.kotlinx.dataframe.util.IS_INTER_COMPARABLE_IMPORT | ||
import java.math.BigDecimal | ||
import java.math.BigInteger | ||
import kotlin.contracts.ExperimentalContracts | ||
import kotlin.contracts.contract | ||
import kotlin.reflect.KClass | ||
|
@@ -44,13 +49,26 @@ public inline fun <reified T> AnyCol.isType(): Boolean = type() == typeOf<T>() | |
|
||
public fun AnyCol.isNumber(): Boolean = isSubtypeOf<Number?>() | ||
|
||
public fun AnyCol.isBigNumber(): Boolean = isSubtypeOf<BigInteger?>() || isSubtypeOf<BigDecimal?>() | ||
|
||
public fun AnyCol.isList(): Boolean = typeClass == List::class | ||
|
||
/** @include [isInterComparable] */ | ||
@Deprecated( | ||
message = IS_COMPARABLE, | ||
replaceWith = ReplaceWith(IS_COMPARABLE_REPLACE, IS_INTER_COMPARABLE_IMPORT), | ||
level = DeprecationLevel.WARNING, | ||
) | ||
public fun AnyCol.isComparable(): Boolean = isInterComparable() | ||
|
||
/** | ||
* Returns `true` if [this] column is comparable, i.e. its type is a subtype of [Comparable] and its | ||
* type argument is not [Nothing]. | ||
* Returns `true` if [this] column is inter-comparable, i.e. | ||
* its elements can be compared with each other. | ||
* | ||
* Technically, this means the elements' common type is a subtype of [Comparable] with | ||
* the type argument not being [Nothing]. | ||
*/ | ||
public fun AnyCol.isComparable(): Boolean = | ||
public fun AnyCol.isInterComparable(): Boolean = | ||
|
||
isSubtypeOf<Comparable<*>?>() && | ||
type().projectTo(Comparable::class).arguments[0].let { | ||
it != KTypeProjection.STAR && | ||
|
Uh oh!
There was an error while loading. Please reload this page.