AngersZhuuuu opened a new pull request #27861: [SPARK_30707]Window function set partitionSpec as order spec when orderSpec is empty URL: https://github.com/apache/spark/pull/27861 ### What changes were proposed in this pull request? In hive, when we use window function, if order spec is empty, it will set partition expression as order spec, but in spark, we won't do this. And when check window expression throw exception ``` SELECT lead(ten, four + 1) OVER (PARTITION BY four), ten, four FROM (SELECT * FROM tenk1 WHERE unique2 < 10 ORDER BY four, ten)s org.apache.spark.sql.AnalysisException Window function lead(ten#x, (four#x + 1), null) requires window to be ordered, please add ORDER BY clause. For example SELECT lead(ten#x, (four#x + 1), null)(value_expr) OVER (PARTITION BY window_partition ORDER BY window_ordering) from table; ``` Do same thing like hive in this pr. ### Why are the changes needed? Improve syntax compatibility ### Does this PR introduce any user-facing change? Yes, we can write window function like ``` SELECT lead(ten, four + 1) OVER (PARTITION BY four), ten, four FROM (SELECT * FROM tenk1 WHERE unique2 < 10 ORDER BY four, ten)s ``` ### 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] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
