Open koperagen opened 1 month ago
We might need to do some additional research with regard to the maintainability of the implementation, mainly the cases where we have to write the same DataFrame logic in two places.
Doing operations on DataFrames with the plugin happens in two places:
@Import
json datagroupBy {}
df.transpose()
-> The df will have a keys: String
column containing the previous column namesI believe we should try, wherever we can, to share the logic between these two scopes. This can only be done in places where the logic is exclusively dependent on the structure, types, or names of the DataFrame. Sharing the logic will help us (and future contributors) to a) fix bugs more easily and b) keep ensuring consistency between the plugin and the library.
I see 3 options for us:
Keep the logic separate (Such as with join
generating names in two places: plugin, library.)
Create a new abstract tree-structure as supertype of both DataFrame and the PluginDataFrameSchema (Such as with insert
, called also from the plugin)
ConeKotlinType
<-> KType
conversionShare logic by running the original function on an "empty" DataFrame (Such as drafted for renameToCamelCase()
)
TypeApproximation
inside the DF or try to find a way to create an empty dataframe wíth KTypes and figure out a way to do ConeKotlinType
<-> KType
Feel free to edit this comment to add more pros and cons to each option or to add more options.
These are just my thoughts for now :) I'm curious to see what you think!
Place for discussion and questions about Kotlin DataFrame compiler plugin
Idea behind it is to make such code compile, provide coding assistance in project files and later in Kotlin Notebooks - on top of already existing code generation in-between notebook cells
Implementation lives here https://github.com/Kotlin/dataframe/tree/compiler-plugin
Demo project that you can clone and run https://github.com/koperagen/df-plugin-demo
Issue that describes required compiler API and provides some information about use case https://youtrack.jetbrains.com/issue/KT-65859