Skip to content

Commit d44bd8c

Browse files
committed
removing typedCol since udf is already adding it.
Suppressing compiler warnings for deprecation and other generated functions
1 parent 20dbd01 commit d44bd8c

File tree

7 files changed

+10
-28
lines changed

7 files changed

+10
-28
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
*/
2020

2121
/**
22+
* DEPRECATED: Use Scala tuples instead.
23+
*
2224
* Helper classes and functions to work with unnamed tuples we call Arities.
2325
* Arities are easier to work with in Kotlin than Scala Tuples since they are Kotlin data classes.
2426
* This means they can be destructured, copied, etc.
@@ -39,7 +41,7 @@
3941
* }
4042
* ```
4143
*/
42-
44+
@file:Suppress("DEPRECATION")
4345
package org.jetbrains.kotlinx.spark.api
4446

4547
import java.io.Serializable

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

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -420,36 +420,13 @@ inline fun <reified T> Column.`as`(): TypedColumn<Any, T> = `as`(encoder<T>())
420420
*/
421421
fun lit(a: Any): Column = functions.lit(a)
422422

423-
/**
424-
* Returns a [TypedColumn] based on the given column name and type [T].
425-
*
426-
* This is just a shortcut to the function from [org.apache.spark.sql.functions] combined with an [as] call.
427-
* For all the functions, simply add `import org.apache.spark.sql.functions.*` to your file.
428-
*
429-
* @see col
430-
* @see as
431-
*/
432-
inline fun <reified T> typedCol(colName: String): TypedColumn<Any, T> = functions.col(colName).`as`<T>()
433-
434423
/**
435424
* Returns a [Column] based on the given class attribute, not connected to a dataset.
436425
* ```kotlin
437426
* val dataset: Dataset<YourClass> = ...
438427
* val new: Dataset<Pair<TypeOfA, TypeOfB>> = dataset.select( col(YourClass::a), col(YourClass::b) )
439428
* ```
440-
* @see typedCol
441-
*/
442-
@Suppress("UNCHECKED_CAST")
443-
inline fun <reified T, reified U> col(column: KProperty1<T, U>): TypedColumn<T, U> = typedCol(column)
444-
445-
/**
446-
* Returns a [Column] based on the given class attribute, not connected to a dataset.
447-
* ```kotlin
448-
* val dataset: Dataset<YourClass> = ...
449-
* val new: Dataset<Pair<TypeOfA, TypeOfB>> = dataset.select( typedCol(YourClass::a), typedCol(YourClass::b) )
450-
* ```
451-
* @see col
452429
*/
453430
@Suppress("UNCHECKED_CAST")
454-
inline fun <reified T, reified U> typedCol(column: KProperty1<T, U>): TypedColumn<T, U> =
431+
inline fun <reified T, reified U> col(column: KProperty1<T, U>): TypedColumn<T, U> =
455432
functions.col(column.name).`as`<U>() as TypedColumn<T, U>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* and Kotlin/Java variants.
2424
*/
2525

26-
@file:Suppress("NOTHING_TO_INLINE", "RemoveExplicitTypeArguments", "unused")
26+
@file:Suppress("NOTHING_TO_INLINE", "RemoveExplicitTypeArguments", "unused", "DEPRECATION")
2727

2828
package org.jetbrains.kotlinx.spark.api
2929

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ inline fun <reified T1, T2> Dataset<Pair<T1, T2>>.takeKeys(): Dataset<T1> = map
197197
* (Kotlin-specific)
198198
* Maps the Dataset to only retain the "keys" or [Arity2._1] values.
199199
*/
200+
@Suppress("DEPRECATION")
200201
@JvmName("takeKeysArity2")
201202
@Deprecated("Use Scala tuples instead.", ReplaceWith(""))
202203
inline fun <reified T1, T2> Dataset<Arity2<T1, T2>>.takeKeys(): Dataset<T1> = map { it._1 }
@@ -218,6 +219,7 @@ inline fun <T1, reified T2> Dataset<Pair<T1, T2>>.takeValues(): Dataset<T2> = ma
218219
* (Kotlin-specific)
219220
* Maps the Dataset to only retain the "values" or [Arity2._2] values.
220221
*/
222+
@Suppress("DEPRECATION")
221223
@JvmName("takeValuesArity2")
222224
@Deprecated("Use Scala tuples instead.", ReplaceWith(""))
223225
inline fun <T1, reified T2> Dataset<Arity2<T1, T2>>.takeValues(): Dataset<T2> = map { it._2 }

scala-tuples-in-kotlin/src/main/kotlin/org/jetbrains/kotlinx/spark/api/tuples/TupleConcatenation.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* limitations under the License.
1818
* =LICENSEEND=
1919
*/
20-
@file:Suppress("FunctionName", "RemoveExplicitTypeArguments")
20+
@file:Suppress("FunctionName", "RemoveExplicitTypeArguments", "UNUSED_PARAMETER")
2121
package org.jetbrains.kotlinx.spark.api.tuples
2222

2323
import scala.Tuple1

scala-tuples-in-kotlin/src/main/kotlin/org/jetbrains/kotlinx/spark/api/tuples/TupleExtending.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* limitations under the License.
1818
* =LICENSEEND=
1919
*/
20-
@file:Suppress("FunctionName", "RemoveExplicitTypeArguments")
20+
@file:Suppress("FunctionName", "RemoveExplicitTypeArguments", "UNUSED_PARAMETER")
2121
package org.jetbrains.kotlinx.spark.api.tuples
2222

2323
import scala.Tuple1

scala-tuples-in-kotlin/src/main/kotlin/org/jetbrains/kotlinx/spark/api/tuples/TupleZip.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* limitations under the License.
1818
* =LICENSEEND=
1919
*/
20+
@file:Suppress("UNUSED_PARAMETER")
2021
package org.jetbrains.kotlinx.spark.api.tuples
2122

2223
import scala.*

0 commit comments

Comments
 (0)