Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/apache-spark/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Scala 在UDFRegistration.register()中指定returnType:DataType_Scala_Apache Spark - Fatal编程技术网

Scala 在UDFRegistration.register()中指定returnType:DataType

Scala 在UDFRegistration.register()中指定returnType:DataType,scala,apache-spark,Scala,Apache Spark,表示寄存器(..)接受returnType。但是当我接受并编译时,我得到以下错误 val spark = SparkSession .builder() .config("spark.master", "local[*]") .config("spark.serializer", classOf[KryoSerializer].getName) .getOrCreate() spark.udf.register("doIt", do_it_func, Arr

表示寄存器(..)接受returnType。但是当我接受并编译时,我得到以下错误

val spark = SparkSession
    .builder()
    .config("spark.master", "local[*]")
    .config("spark.serializer", classOf[KryoSerializer].getName)
    .getOrCreate()

  spark.udf.register("doIt", do_it_func, ArrayType(StructType(Seq(
    StructField("V1", DoubleType),
    StructField("V2", DoubleType),
    StructField("V3", DoubleType)))))

  def do_it_func: String => Seq[(Option[Double], Option[Double], Option[Double])] = {
    (s, r1, r2) => Seq((None, None, None))
  }
为什么我不能通过返回式考试

谢谢, 基翁马

error: overloaded method value register with 
alternatives:[ERROR]   (name: String,f: 
org.apache.spark.sql.api.java.UDF22[_, _, _, _, _, _, _, _, _, _, _, _, _, 
_, _, _, _, _, _, _, _, _, _],returnType: 
org.apache.spark.sql.types.DataType)Unit [ERROR]   (name: String,f: 
org.apache.spark.sql.api.java.UDF21[_, _, _, _, _, _, _, _, _, _, _, _, _, 
_, _, _, _, _, _, _, _, _],returnType: 
org.apache.spark.sql.types.DataType)Unit