Yuming Wang created SPARK-32726:
-----------------------------------

             Summary: Filter by column alias in where clause
                 Key: SPARK-32726
                 URL: https://issues.apache.org/jira/browse/SPARK-32726
             Project: Spark
          Issue Type: Improvement
          Components: SQL
    Affects Versions: 3.1.0
            Reporter: Yuming Wang


{{group by}} and {{order by}} clause support it. but {{where}} does not support 
it:

{noformat}
spark-sql> select id + 1 as new_id from range(5) group by new_id order by 
new_id;
1
2
3
4
5
spark-sql> select id + 1 as new_id from range(5) where new_id > 2;
Error in query: cannot resolve '`new_id`' given input columns: [id]; line 1 pos 
44;
'Project [('id + 1) AS new_id#5]
+- 'Filter ('new_id > 2)
   +- Range (0, 5, step=1, splits=None
{noformat}




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to