title: Spark hive udf: no handler for UDAF analysis exception
body: <p>Created one project 'spark-udf' &amp; written hive udf as below:</p>
  
  <pre><code>package com.spark.udf
  import org.apache.hadoop.hive.ql.exec.UDF
  
  class UpperCase extends UDF with Serializable {
    def evaluate(input: String): String = {
      input.toUpperCase
    }
  </code></pre>
  
  <p>Built it &amp; created jar for it. Tried to use this udf in another spark program:</p>
  
  <pre><code>spark.sql("CREATE OR REPLACE FUNCTION uppercase AS 'com.spark.udf.UpperCase' USING JAR '/home/swapnil/spark-udf/target/spark-udf-1.0.jar'")
  </code></pre>
  
  <p>But following line is giving me exception:</p>
  
  <pre><code>spark.sql("select uppercase(Car) as NAME from cars").show
  </code></pre>
  
  <p><strong>Exception:</strong></p>
  
  <blockquote>
    <p>Exception in thread "main" org.apache.spark.sql.AnalysisException: No
    handler for UDAF 'com.spark.udf.UpperCase'. Use
    sparkSession.udf.register(...) instead.; line 1 pos 7     at
    org.apache.spark.sql.catalyst.catalog.SessionCatalog.makeFunctionExpression(SessionCatalog.scala:1105)
      at
    org.apache.spark.sql.catalyst.catalog.SessionCatalog$$anonfun$org$apache$spark$sql$catalyst$catalog$SessionCatalog$$makeFunctionBuilder$1.apply(SessionCatalog.scala:1085)
      at
    org.apache.spark.sql.catalyst.catalog.SessionCatalog$$anonfun$org$apache$spark$sql$catalyst$catalog$SessionCatalog$$makeFunctionBuilder$1.apply(SessionCatalog.scala:1085)
      at
    org.apache.spark.sql.catalyst.analysis.SimpleFunctionRegistry.lookupFunction(FunctionRegistry.scala:115)
      at
    org.apache.spark.sql.catalyst.catalog.SessionCatalog.lookupFunction(SessionCatalog.scala:1247)
      at
    org.apache.spark.sql.catalyst.analysis.Analyzer$ResolveFunctions$$anonfun$apply$16$$anonfun$applyOrElse$6$$anonfun$applyOrElse$52.apply(Analyzer.scala:1226)
      at
    org.apache.spark.sql.catalyst.analysis.Analyzer$ResolveFunctions$$anonfun$apply$16$$anonfun$applyOrElse$6$$anonfun$applyOrElse$52.apply(Analyzer.scala:1226)
      at
    org.apache.spark.sql.catalyst.analysis.package$.withPosition(package.scala:48)</p>
  </blockquote>
  
  <p>Any help around this is really appreciated.</p>