1
1
package org.jetbrains.kotlinx.dataframe.plugin.impl.api
2
2
3
3
import org.jetbrains.kotlinx.dataframe.DataFrame
4
- import org.jetbrains.kotlinx.dataframe.api.Infer
5
4
import org.jetbrains.kotlinx.dataframe.api.after
6
5
import org.jetbrains.kotlinx.dataframe.api.insert
7
6
import org.jetbrains.kotlinx.dataframe.api.pathOf
8
7
import org.jetbrains.kotlinx.dataframe.api.under
9
8
import org.jetbrains.kotlinx.dataframe.plugin.impl.AbstractInterpreter
10
9
import org.jetbrains.kotlinx.dataframe.plugin.impl.Arguments
11
10
import org.jetbrains.kotlinx.dataframe.plugin.impl.PluginDataFrameSchema
12
- import org.jetbrains.kotlinx.dataframe.plugin.impl.Present
13
- import org.jetbrains.kotlinx.dataframe.plugin.impl.SimpleCol
14
11
import org.jetbrains.kotlinx.dataframe.plugin.impl.asDataColumn
15
12
import org.jetbrains.kotlinx.dataframe.plugin.impl.asDataFrame
16
- import org.jetbrains.kotlinx.dataframe.plugin.impl.data.ColumnAccessorApproximation
17
13
import org.jetbrains.kotlinx.dataframe.plugin.impl.data.ColumnPathApproximation
18
14
import org.jetbrains.kotlinx.dataframe.plugin.impl.data.InsertClauseApproximation
19
- import org.jetbrains.kotlinx.dataframe.plugin.impl.data.KPropertyApproximation
20
15
import org.jetbrains.kotlinx.dataframe.plugin.impl.dataFrame
21
- import org.jetbrains.kotlinx.dataframe.plugin.impl.enum
16
+ import org.jetbrains.kotlinx.dataframe.plugin.impl.ignore
22
17
import org.jetbrains.kotlinx.dataframe.plugin.impl.simpleColumnOf
23
18
import org.jetbrains.kotlinx.dataframe.plugin.impl.toPluginDataFrameSchema
24
19
import org.jetbrains.kotlinx.dataframe.plugin.impl.type
@@ -27,17 +22,18 @@ import org.jetbrains.kotlinx.dataframe.plugin.impl.type
27
22
* @see DataFrame.insert
28
23
*/
29
24
internal class Insert0 : AbstractInterpreter <InsertClauseApproximation >() {
30
- val Arguments .column: SimpleCol by arg()
31
- val Arguments .receiver: PluginDataFrameSchema by dataFrame()
25
+ val Arguments .receiver by dataFrame()
26
+ val Arguments .name: String by arg()
27
+ val Arguments .typeArg1 by type()
32
28
33
29
override fun Arguments.interpret (): InsertClauseApproximation {
34
- return InsertClauseApproximation (receiver, column )
30
+ return InsertClauseApproximation (receiver, simpleColumnOf(name, typeArg1.type) )
35
31
}
36
32
}
37
33
38
34
internal class Insert1 : AbstractInterpreter <InsertClauseApproximation >() {
39
35
val Arguments .name: String by arg()
40
- val Arguments .infer: Infer by enum(defaultValue = Present ( Infer . Nulls ) )
36
+ val Arguments .infer by ignore( )
41
37
val Arguments .expression: TypeApproximation by type()
42
38
val Arguments .receiver: PluginDataFrameSchema by dataFrame()
43
39
@@ -46,28 +42,6 @@ internal class Insert1 : AbstractInterpreter<InsertClauseApproximation>() {
46
42
}
47
43
}
48
44
49
- internal class Insert2 : AbstractInterpreter <InsertClauseApproximation >() {
50
- val Arguments .column: ColumnAccessorApproximation by arg()
51
- val Arguments .infer: Infer by enum(defaultValue = Present (Infer .Nulls ))
52
- val Arguments .expression: TypeApproximation by type()
53
- val Arguments .receiver: PluginDataFrameSchema by dataFrame()
54
-
55
- override fun Arguments.interpret (): InsertClauseApproximation {
56
- return InsertClauseApproximation (receiver, simpleColumnOf(column.name, expression.type))
57
- }
58
- }
59
-
60
- internal class Insert3 : AbstractInterpreter <InsertClauseApproximation >() {
61
- val Arguments .column: KPropertyApproximation by arg()
62
- val Arguments .infer: Infer by enum(defaultValue = Present (Infer .Nulls ))
63
- val Arguments .expression: TypeApproximation by type()
64
- val Arguments .receiver: PluginDataFrameSchema by dataFrame()
65
-
66
- override fun Arguments.interpret (): InsertClauseApproximation {
67
- return InsertClauseApproximation (receiver, simpleColumnOf(column.name, expression.type))
68
- }
69
- }
70
-
71
45
internal class Under0 : AbstractInterpreter <PluginDataFrameSchema >() {
72
46
val Arguments .column: SingleColumnApproximation by arg()
73
47
val Arguments .receiver: InsertClauseApproximation by arg()
@@ -91,28 +65,6 @@ internal class Under1 : AbstractInterpreter<PluginDataFrameSchema>() {
91
65
}
92
66
}
93
67
94
- internal class Under2 : AbstractInterpreter <PluginDataFrameSchema >() {
95
- val Arguments .column: ColumnAccessorApproximation by arg()
96
- val Arguments .receiver: InsertClauseApproximation by arg()
97
-
98
- override fun Arguments.interpret (): PluginDataFrameSchema {
99
- return receiver.df.asDataFrame()
100
- .insert(receiver.column.asDataColumn()).under(pathOf(column.name))
101
- .toPluginDataFrameSchema()
102
- }
103
- }
104
-
105
- internal class Under3 : AbstractInterpreter <PluginDataFrameSchema >() {
106
- val Arguments .column: KPropertyApproximation by arg()
107
- val Arguments .receiver: InsertClauseApproximation by arg()
108
-
109
- override fun Arguments.interpret (): PluginDataFrameSchema {
110
- return receiver.df.asDataFrame()
111
- .insert(receiver.column.asDataColumn()).under(pathOf(column.name))
112
- .toPluginDataFrameSchema()
113
- }
114
- }
115
-
116
68
internal class Under4 : AbstractInterpreter <PluginDataFrameSchema >() {
117
69
val Arguments .column: String by arg()
118
70
val Arguments .receiver: InsertClauseApproximation by arg()
0 commit comments