77 * Licensed under the Apache License, Version 2.0 (the "License");
88 * you may not use this file except in compliance with the License.
99 * You may obtain a copy of the License at
10- *
10+ *
1111 * http://www.apache.org/licenses/LICENSE-2.0
12- *
12+ *
1313 * Unless required by applicable law or agreed to in writing, software
1414 * distributed under the License is distributed on an "AS IS" BASIS,
1515 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1616 * See the License for the specific language governing permissions and
1717 * limitations under the License.
1818 * =LICENSEEND=
1919 */
20+ package org.jetbrains.kotlinx.spark.examples
2021
2122import org.apache.spark.sql.catalyst.InternalRow
2223import org.apache.spark.sql.catalyst.expressions.GenericInternalRow
@@ -25,8 +26,6 @@ import org.apache.spark.unsafe.types.UTF8String
2526import org.glassfish.jersey.internal.guava.MoreObjects
2627import org.jetbrains.kotlinx.spark.api.*
2728import org.jetbrains.kotlinx.spark.api.tuples.tupleOf
28- import java.io.Serializable
29- import kotlin.reflect.jvm.jvmName
3029
3130class CityUserDefinedType : UserDefinedType <City >() {
3231
@@ -65,7 +64,7 @@ class CityUserDefinedType : UserDefinedType<City>() {
6564}
6665
6766@SQLUserDefinedType(udt = CityUserDefinedType ::class )
68- class City (val name : String , val departmentNumber : Int ) : Serializable {
67+ class City (val name : String , val departmentNumber : Int ) {
6968
7069 override fun toString (): String =
7170 MoreObjects
@@ -77,7 +76,8 @@ class City(val name: String, val departmentNumber: Int) : Serializable {
7776
7877fun main () = withSpark {
7978
80- // UDTRegistration.register(City::class.jvmName, CityUserDefinedType::class.jvmName)
79+ // Either use @SQLUserDefinedType or:
80+ // UDTRegistration.register(org.jetbrains.kotlinx.spark.examples.City::class.jvmName, org.jetbrains.kotlinx.spark.examples.CityUserDefinedType::class.jvmName)
8181
8282 val items = listOf (
8383 City (" Amsterdam" , 1 ),
0 commit comments