Не может расширить искру unaryexpression на JavaJAVA

Программисты JAVA общаются здесь
Anonymous
Не может расширить искру unaryexpression на Java

Сообщение Anonymous »

Я пытаюсь написать пользовательскую функцию декодера в Java Targeting Spark 4.0: < /p>

Код: Выделить всё

public class MyDataToCatalyst extends UnaryExpression implements NonSQLExpression, ExpectsInputTypes, Serializable {

//...

}
< /code>
However, I cannot get this to compile, because the class definition of UnaryExpression
is invalid according to Java type hierarchy rules: The two final methods implementing its Scala trait UnaryLike[Epression] have an invalid return type:

Код: Выделить всё

public abstract class UnaryExpression extends Expression implements UnaryLike {

public final TreeNode mapChildren(Function1);
public final TreeNode withNewChildrenInternal(IndexedSeq);

//...
}

< /code>
UnaryExpression
Extends Expression , который представляет собой TreeNode и, следовательно, должен иметь возвратный тип выражения для этих двух методов. И то же самое относится и к невородному .
Компилятор не выполняет эти ошибки соответственно:
'mapChildren(Function1)' in 'org.apache.spark.sql.catalyst.expressions.UnaryExpression' clashes with 'mapChildren(Function1)' in 'org.apache.spark.sql.catalyst.trees.TreeNode'; incompatible return type
'withNewChildrenInternal(IndexedSeq)' in 'org.apache.spark.sql.catalyst.expressions.UnaryExpression' clashes with 'withNewChildrenInternal(IndexedSeq)' in 'org.apache.spark.sql.catalyst.trees.TreeNode'; incompatible return type
< /code>
This actually looks like a bug in the Scala compiler to me, generating a bad class file.
If the methods were not final, I could have probably just overridden them in my subclass to fix the issue, but this way, I'm stuck.

Подробнее здесь: https://stackoverflow.com/questions/797 ... on-in-java

Вернуться в «JAVA»