Chetan Bhat created SPARK-34179:
-----------------------------------

             Summary: array_sort examples provided in 
https://spark.apache.org/docs/latest/api/sql/index.html#array_sort   link not 
working
                 Key: SPARK-34179
                 URL: https://issues.apache.org/jira/browse/SPARK-34179
             Project: Spark
          Issue Type: Bug
          Components: docs
    Affects Versions: 2.4.5
         Environment: Spark 2.4.5
            Reporter: Chetan Bhat


*array_sort examples provided in 
https://spark.apache.org/docs/latest/api/sql/index.html#array_sort link not 
working.*

 

SELECT array_sort(array(5, 6, 1), (left, right) -> case when left < right then 
-1 when left > right then 1 else 0 end); –> *this example when executed in 
spark-sql fails with below error*

SELECT array_sort(array(5, 6, 1), (left, right) -> case when left < right then 
-1 when left > right then 1 else 0 end);
Error in query:
extraneous input '->' expecting \{')', ','}(line 1, pos 48)

== SQL ==
SELECT array_sort(array(5, 6, 1), (left, right) -> case when left < right then 
-1 when left > right then 1 else 0 end)
------------------------------------------------^^^

spark-sql>

 

SELECT array_sort(array('bc', 'ab', 'dc'), (left, right) -> case when left is 
null and right is null then 0 when left is null then -1 when right is null then 
1 when left < right then 1 when left > right then -1 else 0 end);  --> *This 
example when executed fails with below error*

 

spark-sql>
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 >
 > SELECT array_sort(array('bc', 'ab', 'dc'), (left, right) -> case when left 
 > is null and right is null then 0 when left is null then -1 when right is 
 > null then 1 when left < right then 1 when left > right then -1 else 0 end);
Error in query:
extraneous input '->' expecting \{')', ','}(line 1, pos 57)

== SQL ==
SELECT array_sort(array('bc', 'ab', 'dc'), (left, right) -> case when left is 
null and right is null then 0 when left is null then -1 when right is null then 
1 when left < right then 1 when left > right then -1 else 0 end)
---------------------------------------------------------^^^

spark-sql>

 

 



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

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

Reply via email to