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

Extra unnecessary exchange operator in the result of an explain command

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.0.1, 1.1.0
    • SQL
    • None

    Description

      hql("explain select * from src group by key").collect().foreach(println)
      
      [ExplainCommand [plan#27:0]]
      [ Aggregate false, [key#25], [key#25,value#26]]
      [  Exchange (HashPartitioning [key#25:0], 200)]
      [   Exchange (HashPartitioning [key#25:0], 200)]
      [    Aggregate true, [key#25], [key#25]]
      [     HiveTableScan [key#25,value#26], (MetastoreRelation default, src, None), None]
      

      There are two exchange operators.

      However, if we do not use explain...

      hql("select * from src group by key")
      
      res4: org.apache.spark.sql.SchemaRDD = 
      SchemaRDD[8] at RDD at SchemaRDD.scala:100
      == Query Plan ==
      Aggregate false, [key#8], [key#8,value#9]
       Exchange (HashPartitioning [key#8:0], 200)
        Aggregate true, [key#8], [key#8]
         HiveTableScan [key#8,value#9], (MetastoreRelation default, src, None), None
      

      The plan is fine.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            yhuai Yin Huai
            rxin Reynold Xin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment