[ https://issues.apache.org/jira/browse/SPARK-19928?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15906758#comment-15906758 ]
Herman van Hovell commented on SPARK-19928: ------------------------------------------- [~jlaskowski] It is not wrong. Grouping only takes one argument, star's will be replaced by all columns during analysis (look for star expansion in the analyzer). Your table apparently contains more than 1 column, so you get this error. > Incorrect error message when grouping function used with wrong types > -------------------------------------------------------------------- > > Key: SPARK-19928 > URL: https://issues.apache.org/jira/browse/SPARK-19928 > Project: Spark > Issue Type: Improvement > Components: SQL > Affects Versions: 2.2.0 > Reporter: Jacek Laskowski > Priority: Minor > > Despite `grouping` being used with no {{GroupingSets/Cube/Rollup}} the > message is plain wrong as the number of arguments for the function is indeed > correct (but failed type checking). > {code} > scala> sql("select grouping(*) from t1").show > org.apache.spark.sql.AnalysisException: Invalid number of arguments for > function grouping; line 1 pos 7 > at > org.apache.spark.sql.catalyst.analysis.FunctionRegistry$$anonfun$5.apply(FunctionRegistry.scala:476) > at > org.apache.spark.sql.catalyst.analysis.FunctionRegistry$$anonfun$5.apply(FunctionRegistry.scala:459) > at > org.apache.spark.sql.catalyst.analysis.SimpleFunctionRegistry.lookupFunction(FunctionRegistry.scala:89) > at > org.apache.spark.sql.catalyst.catalog.SessionCatalog.lookupFunction(SessionCatalog.scala:1100) > at > org.apache.spark.sql.hive.HiveSessionCatalog.org$apache$spark$sql$hive$HiveSessionCatalog$$super$lookupFunction(HiveSessionCatalog.scala:194) > at > org.apache.spark.sql.hive.HiveSessionCatalog$$anonfun$3.apply(HiveSessionCatalog.scala:194) > at > org.apache.spark.sql.hive.HiveSessionCatalog$$anonfun$3.apply(HiveSessionCatalog.scala:194) > at scala.util.Try$.apply(Try.scala:192) > at > org.apache.spark.sql.hive.HiveSessionCatalog.lookupFunction0(HiveSessionCatalog.scala:194) > at > org.apache.spark.sql.hive.HiveSessionCatalog.lookupFunction(HiveSessionCatalog.scala:180) > at > org.apache.spark.sql.catalyst.analysis.Analyzer$ResolveFunctions$$anonfun$apply$14$$anonfun$applyOrElse$6$$anonfun$applyOrElse$45.apply(Analyzer.scala:1085) > ... > {code} -- This message was sent by Atlassian JIRA (v6.3.15#6346) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org