Skip to content

Commit 4b98160

Browse files
committed
parsing kotlin instants now by default
1 parent 7dc4e8b commit 4b98160

File tree

6 files changed

+1338
-1014
lines changed

6 files changed

+1338
-1014
lines changed

build.gradle.kts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,6 @@ allprojects {
191191
}
192192
tasks.withType<KotlinCompile> {
193193
compilerOptions {
194-
// enables support for kotlin.time.Instant as kotlinx.datetime.Instant was deprecated; Issue #1350
195-
// Can be removed once kotlin.time.Instant is marked "stable".
196-
optIn.add("kotlin.time.ExperimentalTime")
197194
// can be removed once kotlin.uuid.ExperimentalUuidApi is marked "stable".
198195
optIn.add("kotlin.uuid.ExperimentalUuidApi")
199196
}

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/parse.kt

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,13 @@ public interface GlobalParserOptions {
8686
public var parseExperimentalUuid: Boolean
8787

8888
/**
89-
* Whether to allow parsing to the experimental [kotlin.time.Instant] type.
90-
* By default, this is false and instants are recognized as the deprecated [kotlinx.datetime.Instant] type (#1350).
89+
* Whether to allow parsing to the [kotlin.time.Instant] type.
90+
* This is marked "stable" from Kotlin 2.3.0+, so, by default this is `true`.
9191
*
92-
* NOTE: Interacting with an [Instant][kotlin.time.Instant] in your code might require
92+
* If false, instants are recognized as the deprecated [kotlinx.datetime.Instant] type (#1350).
93+
*
94+
* NOTE: If you are using an older Kotlin version,
95+
* interacting with an [Instant][kotlin.time.Instant] in your code might require
9396
* `@`[OptIn][OptIn]`(`[ExperimentalTime][kotlin.time.ExperimentalTime]`::class)`.
9497
* In notebooks, add `-opt-in=kotlin.time.ExperimentalTime` to the compiler arguments.
9598
*/
@@ -127,9 +130,11 @@ public interface GlobalParserOptions {
127130
* NOTE: Interacting with a [Uuid][Uuid] in your code might require
128131
* `@`[OptIn][OptIn]`(`[ExperimentalUuidApi][ExperimentalUuidApi]`::class)`.
129132
* In notebooks, add `-opt-in=kotlin.uuid.ExperimentalUuidApi` to the compiler arguments.
130-
* @param parseExperimentalInstant whether to allow parsing to the experimental [kotlin.time.Instant] type.
131-
* By default, this is false and instants are recognized as the deprecated [kotlinx.datetime.Instant] type (#1350).
132-
* NOTE: Interacting with an [Instant][kotlin.time.Instant] in your code might require
133+
* @param parseExperimentalInstant whether to allow parsing to the [kotlin.time.Instant] type.
134+
* This is marked "stable" from Kotlin 2.3.0+, so, by default this is `true`.
135+
* If false, instants are recognized as the deprecated [kotlinx.datetime.Instant] type (#1350).
136+
* NOTE: If you are using an older Kotlin version,
137+
* interacting with an [Instant][kotlin.time.Instant] in your code might require
133138
* `@`[OptIn][OptIn]`(`[ExperimentalTime][kotlin.time.ExperimentalTime]`::class)`.
134139
* In notebooks, add `-opt-in=kotlin.time.ExperimentalTime` to the compiler arguments.
135140
*/

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/api/parse.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ internal object Parsers : GlobalParserOptions {
186186

187187
useFastDoubleParser = true
188188
parseExperimentalUuid = false
189-
parseExperimentalInstant = false
189+
parseExperimentalInstant = true
190190
_locale = null
191191
nullStrings.addAll(listOf("null", "NULL", "NA", "N/A"))
192192
}

dataframe-jupyter/src/test/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/DataFrameJupyterTest.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ abstract class DataFrameJupyterTest :
99
ReplProvider.forLibrariesTesting(
1010
libraries = setOf("dataframe", "kandy-geo", "kandy"),
1111
extraCompilerArguments = listOf(
12-
"-Xopt-in=kotlin.time.ExperimentalTime",
1312
"-Xopt-in=kotlin.uuid.ExperimentalUuidApi",
1413
),
1514
),

docs/StardustDocs/topics/parse.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ df.parse { age and weight }
3939
`parse` tries to parse every `String`/`Char` column into one of the supported types in the following order:
4040
* `Int`
4141
* `Long`
42-
* `Instant` (`kotlin.time`) (requires `parseExperimentalInstant = true`, available from Kotlin 2.1+.)
43-
* `Instant` (`kotlinx.datetime` and `java.time`)
42+
* `Instant` (`kotlin.time`) (requires `parseExperimentalInstant = true`, enabled by default in DataFrame 1.0.0-Beta5)
43+
* `Instant` (`kotlinx.datetime` and `java.time`) (requires `parseExperimentalInstant = false`)
4444
* `LocalDateTime` (`kotlinx.datetime` and `java.time`)
4545
* `LocalDate` (`kotlinx.datetime` and `java.time`)
4646
* `Duration` (`kotlin.time` and `java.time`)
@@ -84,9 +84,9 @@ Available parser options:
8484
* Enabled by global default
8585
* `parseExperimentalUuid: Boolean` is used to enable or disable parsing to the experimental [`kotlin.uuid.Uuid` class](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.uuid/-uuid/).
8686
* Disabled by global default
87-
* `parseExperimentalInstant: Boolean` is used to enable or disable parsing to the experimental
87+
* `parseExperimentalInstant: Boolean` is used to enable or disable parsing to the
8888
[`kotlin.time.Instant` class](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.time/-instant/), available from Kotlin 2.1+. Will parse to `kotlinx.datetime.Instant` if `false`.
89-
* Disabled by global default
89+
* Disabled by global default, enabled in DataFrame 1.0.0-Beta5.
9090

9191
<!---FUN parseWithOptions-->
9292

0 commit comments

Comments
 (0)