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

Dateset operations should not resolve the analyzed logical plan again

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.4.0
    • 3.4.0
    • SQL
    • None

    Description

      For the following query

       

            sql(
              """
                |CREATE TABLE app_open (
                |  uid STRING,
                |  st TIMESTAMP,
                |  ds INT
                |) USING parquet PARTITIONED BY (ds);
                |""".stripMargin)
      
            sql(
              """
                |create or replace temporary view group_by_error as WITH new_app_open AS (
                |  SELECT
                |    ao.*
                |  FROM
                |    app_open ao
                |)
                |SELECT
                |    uid,
                |    20230208 AS ds
                |  FROM
                |    new_app_open
                |  GROUP BY
                |    1,
                |    2
                |""".stripMargin)
      
            sql(
              """
                |select
                |  `uid`
                |from
                |  group_by_error
                |""".stripMargin).show()

      Spark will throw the following error

       

       

      [GROUP_BY_POS_OUT_OF_RANGE] GROUP BY position 20230208 is not in select list (valid range is [1, 2]).; line 9 pos 4 

       

       

      This is because the logical plan is not set as analyzed and it is analyzed again. The analyzer rules about aggregation/sort ordinals are not idempotent.

      Attachments

        Issue Links

          Activity

            People

              Gengliang.Wang Gengliang Wang
              Gengliang.Wang Gengliang Wang
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: