You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spark.apache.org by Pasha Finkelshteyn <pa...@gmail.com> on 2020/03/20 13:58:35 UTC

Error in custom encoder

Hello everyone,

I'm trying to implement new encoder, which will be able to encode Kotlin
data classes.

They can be generics, so I'm calculating their types in compiletime.

My trouble is I have following code generated:

/* 197 */       final InternalRow deserializetoobject_value_9 = false ?
/* 198 */       null : new kotlin.Pair(deserializetoobject_argValue_1,
deserializetoobject_mutableStateArray_1[0]);

It's obvious that InternalRow can't be assigned with kotlin.Pair

And therefore errors like this:
20/03/19 16:31:18 ERROR CodeGenerator: failed to compile:
org.codehaus.commons.compiler.CompileException: File 'generated.java',
Line 195, Column 74: Assignment conversion not possible from type
"kotlin.Pair" to type "org.apache.spark.sql.catalyst.InternalRow"


Here [1] I put gist with more code: mine and generated and also stacktace

I'm building my encoder against current spark snapshot

Thank you,
Pasha

1. https://gist.github.com/asm0dey/14d5b8aa289403251a7110e5522cff38

Re: Error in custom encoder

Posted by asm0dey <pa...@gmail.com>.
Nevermind, solved it. It was incorrect Literal creation with StructType
instead of ObjectType



--
Sent from: http://apache-spark-developers-list.1001551.n3.nabble.com/

---------------------------------------------------------------------
To unsubscribe e-mail: dev-unsubscribe@spark.apache.org