Comments (9)
@icecreamparlor Nope. While it would be cool, there are just so many JVM dependencies in the project right now, so while in theory, it should be possible, it would be a huge undertaking.
If performance would be the reason to go multiplatform, I think we still have a lot to gain when the Vector API hits the JVM eventually, plus we have plans to convert our Lists to primitive arrays eventually #30.
If, aside from performance, there are other needs for multiplatform support, I would be interested in seeing a proof of concept of (part of) the API, so we can then properly decide whether it would be worth the effort or not.
from dataframe.
-
to support multiplatform, needed to switch to kotlinx.serialization - #312
It would be nice if the part with the parser was separated into a separate module -
also appeared kotlinx-io - https://github.com/Kotlin/kotlinx-io
from dataframe.
Gradle & KSP plugins need to be tested in multiplatform projects when the library is ready
- ImportDataSchema annotation usage
dataframes { }
Gradle configutation usage
Should be a big deal, so treat is as a note for future for testing purposes. Not a blocker or anything
from dataframe.
I took a closer look at multiplatform support and conducted some experiments with it. Initially, I made some erroneous conclusions.
Here are the issues I discovered:
- Support for generated code and proper source configuration
- DataFrame plugin - there is support for different targets in ksp.
- Plugins working with code or kdoc - such as
korro
anddocProcessor
. In the case ofkorro
, it theoretically will work, as it simply finds a function and processes the function body, in the case of common code there should be no problems. WithdocProcessor
, I don't know, as the structure will change, surely changes will be needed for it too. - Jupyter - it's necessary to separate the logic related to notebooks and Jupyter and move it to the jvm part
- kotlinpoet - it's multiplatform, but only supports the jvm target
- Java types - the code uses
java.time
,BigDecimal
,java.io
,java.util
,serializable
. Some of this is solvable, for example, with support forkotlinx-datetime
,kotlinx-io
orokio
.BigDecimal
and its handling need to be moved to a jvm module. The rest needs further exploration. csv
,tsv
,json
- all our reading is jvm dependent- jdbc)
- concurrent - using atomic should solve the problem
- There were problems with calculating the types of receivers
- Java reflection β there's a small amount of Java reflection. Perhaps it can be replaced by
kotlin.reflect.jvm
, which is also tied to the jvm) - Kotlin reflection β the code uses JVM reflection in many places. For example:
- isAbstract
- KVisibility
- kotlin.reflect.jvm
- jvmErasure
- isAccessible
- javaField
- kotlin.reflect.full
- isSubclassOf
- isSubtypeOf
- isSuperclassOf
- withNullability
- findAnnotation
- hasAnnotation
- memberProperties
- allSuperclasses
- createType
- primaryConstructor
This is used in methods, for example: convert
, update
, join
, aggregate
, and others. But it's also used in TypeUtils
, and methods from there are called when creating new columns, that is, practically with any operation. There's no simple replacement or implementation through expect
/actual
for the same jvmErasure
in Kotlin/Native, so a full refactoring of this logic is required. In some cases, I assume the use of reflection is excessive, and in the case of type erasure, I see the following. The simplest way is to go through the data in Kotlin/Native and calculate the type, but this carries very large overheads. Another option is to calculate the type when the data comes from outside, that is, when creating a dataframe, keep it all the time and reuse it constantly, as it does not always happen now. When calculating a new type during operations with the dataframe, a resolver is necessary, and this will require implementing quite complex logic. Also, I assume that some problems with reflection will be solved with the help of a compiler plugin.
As a result, I do not see multiplatform support with Kotlin/Native (ios) as feasible in the near future, as it requires a lot of effort, which presumably could be solved by Kotlin itself in the future.
Multiplatform support only for JVM and Android seems like a more realistic task but will require:
- project configuration
- code refactoring, to separate logic. So that in the common module there would ideally be very limited but isolated code
- support for tasks such as #312, #587 , support kotlinx-io
from dataframe.
There's probably too much JVM reflection going on for this to be easy, let alone viable :/
from dataframe.
Any Updates ?
from dataframe.
Doubts arose about multiplatform support in dataframe, because the library uses a lot of reflections.
I've looked into this a bit, most of the reflection we use is in common. Therefore, if there are problems, then in isolated cases
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.reflect/
from dataframe.
If you look at implementation files like this:
https://github.com/Kotlin/dataframe/blob/master/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/TypeUtils.kt you can see we use jvmErasure
a lot all over the place. I'm not sure if there's a common alternative for that. This needs to be checked.
from dataframe.
In fact, this is the only thing I noticed that is strongly tied to the platform.
In this case, for jvm everything will be the same, for native it will be possible to come up with a workaround, with wasmJs Iβm not sure if itβs worth supporting at all
from dataframe.
Related Issues (20)
- Documentation needed for Columns Selection DSL
- Change serialization format for rendering in IntelliJ IDEA
- Provide information to contributors regarding KDoc preprocessor
- Add support for reading Parquet files HOT 4
- WriteExcel sheets support HOT 2
- Version bumps needed for security
- Incorrect outputs for the `add` example HOT 2
- `filterJoin` example missing (What is `filter` in join types?) HOT 1
- `joinWith` method is missing HOT 6
- KDoc rendering looks odd on 2024 Nightly IntelliJ HOT 5
- Release RC for 0.13.0 HOT 5
- Usage of Java's `LocalTime` instead of Kotlinx's HOT 1
- Documentation missing: Parse works with JSON too
- Alternative CSV reader HOT 2
- Apache Feather Categorical Data Type like in Pandas HOT 4
- NPE in FrameColumnImpl.schema property HOT 2
- Update Kover to 0.7.6
- Update kotest-assertions to 5.8.0
- Update dokka to 1.9.10 HOT 3
- Update korro to 0.1.6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dataframe.