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

UnresolvedException: Invalid call to dataType on unresolved object caused by GetDateFieldOperations

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.2.1, 3.3.0
    • None
    • SQL
    • None

    Description

      test("GetDateFieldOperations should skip unresolved nodes") {
        withSQLConf(SQLConf.ANSI_ENABLED.key -> "true") {
          val df = Seq("1644821603").map(i => (i.toInt, i)).toDF("tsInt", "tsStr")
          val df1 = df.select(df("tsStr").cast("timestamp")).as("df1")
          val df2 = df.select(df("tsStr").cast("timestamp")).as("df2")
          df1.join(df2, $"df1.tsStr" === $"df2.tsStr", "left_outer")
          val df3 = df1.join(df2, $"df1.tsStr" === $"df2.tsStr", "left_outer")
            .select($"df1.tsStr".as("timeStr")).as("df3")
          // This throws "UnresolvedException: Invalid call to
          // dataType on unresolved object" instead of "AnalysisException: Column 'df1.timeStr' does not exist."
          df3.join(df1, year($"df1.timeStr") === year($"df3.tsStr"))
        }
      } 

      Attachments

        Issue Links

          Activity

            People

              Ngone51 wuyi
              Ngone51 wuyi
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: