Skip to content

Commit 635dc94

Browse files
committed
Added docs in a couple of files, added multiple conversions regarding tuples, pairs, arities etc.
1 parent b038490 commit 635dc94

File tree

6 files changed

+382
-1
lines changed

6 files changed

+382
-1
lines changed

kotlin-spark-api/3.2/src/main/kotlin/org/jetbrains/kotlinx/spark/api/VarArities.kt renamed to kotlin-spark-api/3.2/src/main/kotlin/org/jetbrains/kotlinx/spark/api/Arities.kt

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,30 @@
1717
* limitations under the License.
1818
* =LICENSEEND=
1919
*/
20+
2021
/**
21-
* Helper classes and functions to work with unnamed tuples
22+
* Helper classes and functions to work with unnamed tuples we call Arities.
23+
* Arities are easier to work with in Kotlin than Scala Tuples since they are Kotlin data classes.
24+
* This means they can be destructured, copied, etc.
25+
* Finally, the Arities are Serializable, meaning they can be used inside RDDs and they can be broadcast.
26+
*
27+
* Example:
28+
* ```kotlin
29+
* // creation
30+
* val tuple: Arity3<Int, String, Double> = c(1, "test", 1.0)
31+
*
32+
* // addition
33+
* val newTuple: Arity5<Int, String, Double, Int, Int> = tuple + c(1, 2)
34+
*
35+
* // destructuring
36+
* val dataset: Dataset<Arity2<Int, Double>> = ...
37+
* dataset.map { (a: Int, b: Double) ->
38+
* (a + b).toString()
39+
* }
40+
*
41+
* ```
2242
*/
43+
2344
package org.jetbrains.kotlinx.spark.api
2445

2546
import java.io.Serializable

kotlin-spark-api/3.2/src/main/kotlin/org/jetbrains/kotlinx/spark/api/Column.kt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
/*-
2+
* =LICENSE=
3+
* Kotlin Spark API: API for Spark 3.0+ (Scala 2.12)
4+
* ----------
5+
* Copyright (C) 2019 - 2021 JetBrains
6+
* ----------
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
* =LICENSEEND=
19+
*/
20+
21+
/**
22+
* This file contains all Column helper functions.
23+
* This includes easier Column creation and operator functions.
24+
*/
25+
126
package org.jetbrains.kotlinx.spark.api
227

328
import org.apache.spark.sql.Column

0 commit comments

Comments
 (0)