Serge Rielau created SPARK-46625:
------------------------------------

             Summary: IDENTIFIER clause does not work with CTE reference
                 Key: SPARK-46625
                 URL: https://issues.apache.org/jira/browse/SPARK-46625
             Project: Spark
          Issue Type: Bug
          Components: Spark Core
    Affects Versions: 3.3.4
            Reporter: Serge Rielau


IDENTIFIER clause does not pick up CTE 

DECLARE agg = 'max';
DECLARE col = 'c1';
DECLARE tab = 'T';

WITH S(c1, c2) AS (VALUES(1, 2), (2, 3)),
      T(c1, c2) AS (VALUES ('a', 'b'), ('c', 'd'))
SELECT IDENTIFIER(agg)(IDENTIFIER(col)) FROM IDENTIFIER(tab);

[TABLE_OR_VIEW_NOT_FOUND] The table or view `T` cannot be found. Verify the 
spelling and correctness of the schema and catalog.

If you did not qualify the name with a schema, verify the current_schema() 
output, or qualify the name with the correct schema and catalog.

To tolerate the error on drop use DROP VIEW IF EXISTS or DROP TABLE IF EXISTS. 
SQLSTATE: 42P01; line 3 pos 45;

'Project [unresolvedalias(expressionwithunresolvedidentifier('agg, 
org.apache.spark.sql.catalyst.parser.AstBuilder$$Lambda$2785/0x0000009002071490@126688a7))]

+- 'UnresolvedRelation [T], [], false



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to