wuyi created SPARK-38266:
----------------------------

             Summary: UnresolvedException: Invalid call to dataType on 
unresolved object caused by GetDateFieldOperations
                 Key: SPARK-38266
                 URL: https://issues.apache.org/jira/browse/SPARK-38266
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 3.2, 3.3.0
            Reporter: wuyi


{code:java}
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"))
  }
} {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to