Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-10741

Hive Query Having/OrderBy against Parquet table is not working

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.0
    • Fix Version/s: 1.5.2, 1.6.0
    • Component/s: SQL
    • Labels:
      None

      Description

      Failed Query with Having Clause

        def testParquetHaving() {
          val ddl =
            """CREATE TABLE IF NOT EXISTS test ( c1 string, c2 int ) STORED AS PARQUET"""
          val failedHaving =
            """ SELECT c1, avg ( c2 ) as c_avg
              | FROM test
              | GROUP BY c1
              | HAVING ( avg ( c2 ) > 5)  ORDER BY c1""".stripMargin
          TestHive.sql(ddl)
          TestHive.sql(failedHaving).collect
        }
      
      org.apache.spark.sql.AnalysisException: resolved attribute(s) c2#16 missing from c1#17,c2#18 in operator !Aggregate [c1#17], [cast((avg(cast(c2#16 as bigint)) > cast(5 as double)) as boolean) AS havingCondition#12,c1#17,avg(cast(c2#18 as bigint)) AS c_avg#9];
      	at org.apache.spark.sql.catalyst.analysis.CheckAnalysis$class.failAnalysis(CheckAnalysis.scala:37)
      	at org.apache.spark.sql.catalyst.analysis.Analyzer.failAnalysis(Analyzer.scala:44)
      	at org.apache.spark.sql.catalyst.analysis.CheckAnalysis$$anonfun$checkAnalysis$1.apply(CheckAnalysis.scala:154)
      	at org.apache.spark.sql.catalyst.analysis.CheckAnalysis$$anonfun$checkAnalysis$1.apply(CheckAnalysis.scala:49)
      
      

      Failed Query with OrderBy

        def testParquetOrderBy() {
          val ddl =
            """CREATE TABLE IF NOT EXISTS test ( c1 string, c2 int ) STORED AS PARQUET"""
          val failedOrderBy =
            """ SELECT c1, avg ( c2 ) c_avg
              | FROM test
              | GROUP BY c1
              | ORDER BY avg ( c2 )""".stripMargin
          TestHive.sql(ddl)
          TestHive.sql(failedOrderBy).collect
        }
      
      org.apache.spark.sql.AnalysisException: resolved attribute(s) c2#33 missing from c1#34,c2#35 in operator !Aggregate [c1#34], [avg(cast(c2#33 as bigint)) AS aggOrder#31,c1#34,avg(cast(c2#35 as bigint)) AS c_avg#28];
      	at org.apache.spark.sql.catalyst.analysis.CheckAnalysis$class.failAnalysis(CheckAnalysis.scala:37)
      	at org.apache.spark.sql.catalyst.analysis.Analyzer.failAnalysis(Analyzer.scala:44)
      

        Attachments

          Activity

            People

            • Assignee:
              cloud_fan Wenchen Fan
              Reporter:
              ianlcsd Ian
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: