Skip to content

Commit 850480a

Browse files
FelixEnglasm0dey
authored andcommitted
add inlined schema()
1 parent 697fd31 commit 850480a

File tree

1 file changed

+3
-0
lines changed
  • kotlin-spark-api/2.4/src/main/kotlin/org/jetbrains/kotlinx/spark/api

1 file changed

+3
-0
lines changed

kotlin-spark-api/2.4/src/main/kotlin/org/jetbrains/kotlinx/spark/api/ApiV1.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,9 @@ inline fun <reified R> Dataset<*>.toArray(): Array<R> = to<R>().collect() as Arr
269269
*/
270270
fun <T> Dataset<T>.showDS(numRows: Int = 20, truncate: Boolean = true) = apply { show(numRows, truncate) }
271271

272+
@OptIn(ExperimentalStdlibApi::class)
273+
inline fun <reified T> schema(map: Map<String, KType> = mapOf()) = schema(typeOf<T>(), map)
274+
272275
@OptIn(ExperimentalStdlibApi::class)
273276
fun schema(type: KType, map: Map<String, KType> = mapOf()): DataType {
274277
val primitiveSchema = knownDataTypes[type.classifier]

0 commit comments

Comments
 (0)