code: def registerJavaUDAF(self, name, javaClassName):
          
  
          self.sparkSession._jsparkSession.udf().registerJavaUDAF(name, javaClassName)
docs: Register a Java user-defined aggregate function as a SQL function.
  
          :param name: name of the user-defined aggregate function
          :param javaClassName: fully qualified name of java class
  
          >>> spark.udf.registerJavaUDAF("javaUDAF", "test.org.apache.spark.sql.MyDoubleAvg")
          >>> df = spark.createDataFrame([(1, "a"),(2, "b"), (3, "a")],["id", "name"])
          >>> df.createOrReplaceTempView("df")
          >>> spark.sql("SELECT name, javaUDAF(id) as avg from df group by name").collect()
          [Row(name=u'b', avg=102.0), Row(name=u'a', avg=102.0)]