AngersZhuuuu opened a new pull request #32149:
URL: https://github.com/apache/spark/pull/32149


   ### What changes were proposed in this pull request?
   According to 
https://github.com/apache/spark/pull/29087#discussion_r612267050,  add UT in 
`transform.sql`
   
   It seems that distinct is not recognized as a reserved word here
   
   ```
   +-- !query
   SELECT TRANSFORM(distinct b, a, c)
     USING 'cat' AS (a, b, c)
   FROM script_trans
   WHERE a <= 4
   -- !query schema
   struct<>
   -- !query output
   org.apache.spark.sql.AnalysisException
   cannot resolve 'distinct' given input columns: [script_trans.a, 
script_trans.b, script_trans.c]; line 1 pos 17
   
   
   -- !query
   explain extended SELECT TRANSFORM(distinct b, a, c)
                      USING 'cat' AS (a, b, c)
                    FROM script_trans
                    WHERE a <= 4
   -- !query schema
   struct<plan:string>
   -- !query output
   == Parsed Logical Plan ==
   'ScriptTransformation [*], cat, [a#x, b#x, c#x], 
ScriptInputOutputSchema(List(),List(),None,None,List(),List(),None,None,false)
   +- 'Project ['distinct AS b#x, 'a, 'c]
      +- 'Filter ('a <= 4)
         +- 'UnresolvedRelation [script_trans], [], false
   
   == Analyzed Logical Plan ==
   org.apache.spark.sql.AnalysisException: cannot resolve 'distinct' given 
input columns: [script_trans.a, script_trans.b, script_trans.c]; line 1 pos 34;
   'ScriptTransformation [*], cat, [a#x, b#x, c#x], 
ScriptInputOutputSchema(List(),List(),None,None,List(),List(),None,None,false)
   +- 'Project ['distinct AS b#x, a#x, c#x]
      +- Filter (a#x <= 4)
         +- SubqueryAlias script_trans
            +- View (`script_trans`, [a#x,b#x,c#x])
               +- Project [cast(a#x as int) AS a#x, cast(b#x as int) AS b#x, 
cast(c#x as int) AS c#x]
                  +- Project [a#x, b#x, c#x]
                     +- SubqueryAlias script_trans
                        +- LocalRelation [a#x, b#x, c#x]
   ```
   
   
   ### Why are the changes needed?
   
   
   
   ### Does this PR introduce _any_ user-facing change?
   No
   
   
   ### How was this patch tested?
   Added Ut
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to