1
1
package org.jetbrains.kotlinx.dataframe.explainer
2
2
3
3
import com.beust.klaxon.JsonObject
4
- import org.jetbrains.kotlinx.dataframe.AnyFrame
5
- import org.jetbrains.kotlinx.dataframe.api.print
6
4
import java.io.File
7
5
import java.util.concurrent.atomic.AtomicInteger
8
6
import org.jetbrains.kotlinx.dataframe.AnyCol
7
+ import org.jetbrains.kotlinx.dataframe.AnyFrame
9
8
import org.jetbrains.kotlinx.dataframe.DataFrame
10
9
import org.jetbrains.kotlinx.dataframe.DataRow
11
10
import org.jetbrains.kotlinx.dataframe.RowValueFilter
@@ -19,11 +18,13 @@ import org.jetbrains.kotlinx.dataframe.api.Pivot
19
18
import org.jetbrains.kotlinx.dataframe.api.PivotGroupBy
20
19
import org.jetbrains.kotlinx.dataframe.api.ReducedPivot
21
20
import org.jetbrains.kotlinx.dataframe.api.ReducedPivotGroupBy
21
+ import org.jetbrains.kotlinx.dataframe.api.Split
22
22
import org.jetbrains.kotlinx.dataframe.api.SplitWithTransform
23
23
import org.jetbrains.kotlinx.dataframe.api.Update
24
24
import org.jetbrains.kotlinx.dataframe.api.format
25
25
import org.jetbrains.kotlinx.dataframe.api.frames
26
26
import org.jetbrains.kotlinx.dataframe.api.into
27
+ import org.jetbrains.kotlinx.dataframe.api.print
27
28
import org.jetbrains.kotlinx.dataframe.api.toDataFrame
28
29
import org.jetbrains.kotlinx.dataframe.api.values
29
30
import org.jetbrains.kotlinx.dataframe.api.where
@@ -44,7 +45,7 @@ private fun convertToHTML(dataframeLike: Any): DataFrameHtmlData {
44
45
is ReducedPivot <* > -> dataframeLike.values().toDataFrame().toHTML()
45
46
is PivotGroupBy <* > -> dataframeLike.frames().toHTML()
46
47
is ReducedPivotGroupBy <* > -> dataframeLike.values().toHTML()
47
- is SplitWithTransform <* , * , * > -> DataFrameHtmlData (body = " <p> ${ dataframeLike:: class } </p> " )
48
+ is SplitWithTransform <* , * , * > -> dataframeLike.into().toHTML( )
48
49
is Merge <* , * , * > -> dataframeLike.into(" merged" ).toHTML()
49
50
is Gather <* , * , * , * > -> dataframeLike.into(" key" , " value" ).toHTML()
50
51
// is Update<*, *> -> DataFrameHtmlData(body = "<p>${dataframeLike::class}</p>")
@@ -64,6 +65,13 @@ private fun convertToHTML(dataframeLike: Any): DataFrameHtmlData {
64
65
is AnyFrame -> dataframeLike.toHTML()
65
66
is AnyCol -> dataframeLike.toDataFrame().toHTML()
66
67
is DataRow <* > -> dataframeLike.toDataFrame().toHTML()
68
+ is Split <* , * > -> dataframeLike.toDataFrame().toHTML()
69
+ // is MoveClause<*, *>-> null
70
+ // is RenameClause<*, *> -> null
71
+ // is ReplaceClause<*, *> -> null
72
+ // is GroupClause<*, *> -> null
73
+ // is InsertClause<*> -> null
74
+ // is FormatClause<*, *> -> null
67
75
else -> throw IllegalArgumentException (" Unsupported type: ${dataframeLike::class } " )
68
76
}
69
77
}
@@ -76,6 +84,13 @@ private fun convertToDescription(dataframeLike: Any): String {
76
84
is PivotGroupBy <* > -> " PivotGroupBy"
77
85
is ReducedPivotGroupBy <* > -> " ReducedPivotGroupBy"
78
86
is SplitWithTransform <* , * , * > -> " SplitWithTransform"
87
+ is Split <* , * > -> " Split"
88
+ // is MoveClause<*, *> -> "Move"
89
+ // is RenameClause<*, *> -> "Rename"
90
+ // is ReplaceClause<*, *> -> "Replace"
91
+ // is GroupClause<*, *> -> "Group"
92
+ // is InsertClause<*> -> "Insert"
93
+ // is FormatClause<*, *> -> "Format"
79
94
is Merge <* , * , * > -> " Merge"
80
95
is Gather <* , * , * , * > -> " Gather"
81
96
is Update <* , * > -> " Update"
@@ -176,7 +191,7 @@ object PluginCallback {
176
191
<details>
177
192
<summary>${expressions.joinToString(" ." ) { it.source }
178
193
.also {
179
- if (it.length > 88 ) TODO (" expression is too long. better to split sample in multiple snippets" )
194
+ if (it.length > 95 ) TODO (" expression is too long ${it.length} . better to split sample in multiple snippets" )
180
195
}
181
196
.escapeHTML()} </summary>
182
197
${details.body}
0 commit comments