我正在努力实施org.apache.spark.sql.Row
. 接口有几个方法的默认实现,IntelliJ 不会抱怨没有重写这些方法。但是,当使用 Maven 构建时,我得到:
FunctionalRow is not abstract and does not override abstract method mkString(java.lang.String,java.lang.String,java.lang.String) in org.apache.spark.sql.Row
下面是类的实现:
import java.util.List;
import java.util.function.Supplier;
import org.apache.spark.sql.Row;
import scala.collection.JavaConverters;
import scala.collection.Seq;
public class FunctionalRow implements Row {
protected List<Supplier<Object>> suppliers;
public FunctionalRow(List<Supplier<Object>> suppliers) {
this.suppliers = suppliers;
}
@Override
public int length() {
return suppliers.size();
}
@Override
public Object get(int i) {
return suppliers.get(i).get();
}
@Override
public Row copy() {
return this;
}
@Override
public Seq<Object> toSeq() {
return JavaConverters.asScalaIteratorConverter(suppliers.stream().map(s -> s.get()).iterator()).asScala().toSeq();
}
}
maven-编译器-插件设置:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<executions>
<execution>
<id>default-compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</execution>
<execution>
<id>default-testCompile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
任何帮助,将不胜感激!
www说
相关分类