Migration to 1.0
Deprecations and removals
As we move toward version 1.0, many functions have been changed, deprecated, or removed. This section provides a complete overview of all API changes to help you migrate to 1.0.
Renamed functions and classes to the correct CamelCase spelling
All functions and classes in Kotlin DataFrame have been renamed to the correct CamelCase spelling.
See below for a complete list of the renamed functions and classes.
Migration to Deephaven CSV
All CSV (as well as TSV) IO was migrated to a new, fast, and efficient Deephaven CSV implementation. It significantly improves CSV IO performance and brings many new parametrization options.
All related methods are now located in the separate dataframe-csv module (which is included by default in the general dataframe artifact and in %use dataframe in Kotlin Notebook).
Functions were also renamed to the correct CamelCase spelling.
All new functions keep the same arguments as before and additionally introduce new ones. Also, there are new arguments that expose Deephaven CSV features.
See Read from CSV.
0.15 | 1.0 |
|---|---|
|
|
|
|
|
|
|
|
|
|
Migration to Standard Library Instant
Since Kotlin 2.1.20, Instant is now part of the standard library
(as kotlin.time.Instant). You can still use the old (deprecated) kotlinx.datetime.Instant type, but its support will be removed in Kotlin DataFrame 1.1.
For now, each Instant-related operation has been split into two new ones — one for the new stdlib kotlin.time.Instant and one for the old deprecated kotlinx.datetime.Instant. The behavior of old operations remains unchanged: they work with kotlinx.datetime.Instant and raise ERROR in 1.0. In version 1.1, they will be returned and will operate on the new stdlib kotlin.time.Instant.
0.15 | 1.0 | Note |
|---|---|---|
|
|
|
| Will be renamed back into | |
|
|
|
| Will be renamed back into | |
|
|
|
| Will be renamed back into |
In version 1.0-Beta5 and later, all parsing operations convert Instant values into the new standard library kotlin.time.Instant type by default. To enable parsing into the deprecated kotlinx.datetime.Instant, set the corresponding parsing option ParserOptions.parseExperimentalInstant = false (before 1.0-Beta5, this option was false, from 1.0-Beta5 onwards it is true by default).
For example:
Deprecation of cols() and other methods in Columns Selection DSL
cols() overloads without arguments, which select all columns of a DataFrame or all subcolumns inside a column group in the Columns Selection DSL, are deprecated in favor of all() and allCols() respectively. These replacements allow the Compiler Plugin to fully support such selections.
colsAtAnyDepth(), colsInGroups(), and single() overloads with a predicate argument that filters columns are also deprecated for better Compiler Plugin support. Use .filter(predicate) for filtering instead.
0.15 | 1.0 |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Removed functions and classes
The next functions and classes raise ERROR in 1.0 and will be removed in 1.1.
0.15 | 1.0 | Reason |
|---|---|---|
|
| Replaced with another function. |
|
| Replaced with another function. |
|
| Replaced with another function. |
|
| Renamed to better reflect its purpose. |
|
| Replaced with another function. |
|
| Renamed to better reflect its purpose. |
|
| Renamed to better reflect its purpose. |
|
| Renamed to better reflect its purpose. |
|
| Renamed to better reflect its purpose. |
|
| Renamed to better reflect its purpose. |
|
| Renamed to better reflect its purpose. |
|
| Renamed to better reflect its purpose. |
|
| Renamed to the correct CamelCase. |
|
| Renamed to the correct CamelCase. |
|
| Renamed to the correct CamelCase. |
|
| Renamed to the correct CamelCase. |
|
| Replaced with another function. |
|
| Renamed to the correct CamelCase. |
|
| Renamed to the correct CamelCase. |
|
| Replaced with another overload. |
|
| Replaced with another overload. |
|
| Renamed to better reflect its purpose. |
|
| Renamed to better reflect its purpose. |
The next functions and classes raise WARNING in 1.0 and ERROR in 1.1.
0.15 | 1.0 | Reason |
|---|---|---|
|
| Removed a shortcut to clarify the behaviour; Only for |
|
| Replaced with another function. |
|
| Replaced with another function. |
|
| Removed duplicated functionality. |
|
| Removed a shortcut to clarify the behaviour; Only for |
|
| Removed a shortcut to clarify the behaviour; Only for |
|
| Renamed to to improve completion. |
|
| Removed a shortcut to clarify the behaviour; |
|
| Removed a shortcut to clarify the behaviour; |
|
| Removed a shortcut to clarify the behaviour; |
|
| Removed duplicated functionality. |
|
| Renamed to better reflect the English sentence "rename this column to that". |
Parsing and Converting Date-Time
In 0.15 and up to 1.0-Beta4 we did support the kotlinx-datetime types; however, they were still treated second-level in DataFrame. ParserOptions were still built around the Java DataTimeFormatter-paradigm. Starting from 1.0-Beta5, kotlinx-datetime types now become first-class citizens, while still allowing you to use Java types if you need them.
0.15 | 1.0 | Reason |
|---|---|---|
df.parse()
|
df.parse()
| Default parsing behavior remains largely unchanged. |
df.parse(
ParserOptions(
skipTypes = setOf(
typeOf<kotlinx.datetime.LocalDate>(),
...,
),
),
)
|
df.parse(
ParserOptions(dateTime = DateTimeParserOptions.Java),
)
| If you want to force parsing to Java date-time types, you no longer have use skipTypes, you can simply change the `dateTime` argument. |
DataFrame.parser.addSkipType(
typeOf<kotlinx.datetime.LocalDate>(),
)
|
DataFrame.parser.dateTimeLibrary = ParseDateTimeLibrary.JAVA
| The same logic applies for the global parser options. |
ParserOptions(dateTimeFormatter = myFormatter)
| Kotlin:
ParserOptions(
dateTime = DateTimeParserOptions.Kotlin
.withFormat<_>(myKotlinFormat),
)
| You now need to explicitly specify you expect Java or Kotlin date-time types via `DateTimeParserOptions.X`. Then you can specify the relevant options, like a `kotlinx.datetime.format.DateTimeFormat` or `java.time.DateTimeFormatter`. These are typed now too, optionally for Java. |
Java:
ParserOptions(
dateTime = DateTimeParserOptions.Java
.withFormatter<java.time.LocalDateTime>(myJavaFormatter),
)
| ||
ParserOptions(
locale = myLocale,
dateTimeFormatter = myFormatter,
)
|
ParserOptions(
dateTime = DateTimeParserOptions.Java
.withLocale(myLocale)
.withFormatter<java.time.LocalDateTime>(myFormatter),
)
| Locale for date-time only works for Java types. If you need Kotlin types ánd a locale use convert to convert to Kotlin types afterwards. |
ParserOptions(dateTimePattern = "MM/dd yyyy")
| Kotlin:
@OptIn(FormatStringsInDatetimeFormats::class)
ParserOptions(
dateTime = DateTimeParserOptions.Kotlin
.withPattern<kotlinx.datetime.LocalDate>("MM/dd yyyy"),
)
| Again, you now need to specify the target date-time library and the expected type for your pattern (optionally for Java). In Kotlin you also need to opt-in, because using `DateTimeFormat` instead is recommended. |
Java:
ParserOptions(
dateTime = DateTimeParserOptions.Java
.withPattern<java.time.LocalDate>("MM/dd yyyy"),
)
| ||
DataFrame.parser.addDateTimePattern("MM/dd yyyy")
| Kotlin:
@OptIn(FormatStringsInDatetimeFormats::class)
DataFrame.parser
.addDateTimeUnicodePattern<kotlinx.datetime.LocalDate>("MM/dd yyyy")
| Same idea. Though you can now also use `...addDateTimeFormat()` / `...addJavaDateTimeFormatter()`, which we would recommend more. |
Java:
DataFrame.parser
.addJavaDateTimePattern<java.time.LocalDate>("MM/dd yyyy")
| ||
convert { stringCols }.toLocalDate(pattern = "MM/dd yyyy")
| Kotlin:
@OptIn(FormatStringsInDatetimeFormats::class)
convert { stringCols }.toLocalDate(pattern = "MM/dd yyyy")
| Same logic applies to convert: you need to opt-in to use patterns for Kotlin types and specify "Java" for Java types. |
Java:
convert { stringCols }.toJavaLocalDate(pattern = "MM/dd yyyy")
| ||
stringCol.convertToLocalDate(locale = Locale.GERMAN)
|
stringCol
.convertToJavaLocalDate(locale = Locale.GERMAN)
.convertToLocalDate()
| If you need to supply a locale to be able to parse date-time types, parse to Java types first, then convert to Kotlin ones. |
For more information, check out Parsing Date-time Strings.