guihuawen created SPARK-48006:
---------------------------------

             Summary: add SortOrder for window function which has no orderSpec
                 Key: SPARK-48006
                 URL: https://issues.apache.org/jira/browse/SPARK-48006
             Project: Spark
          Issue Type: Improvement
          Components: SQL
    Affects Versions: 4.0.0
            Reporter: guihuawen
             Fix For: 4.0.0


I am doing Hive SQL to switch to Spark SQL.

 

In Hive SQL

 

hive> explain select *,row_number() over (partition by day) rn from 
testdb.zeropart_db;

OK
Explain

 

In Spark SQL

spark-sql> explain select *,row_number() over (partition by age ) rn  from 
testdb.zeropart_db;

plan

== Physical Plan ==

org.apache.spark.sql.AnalysisException: Window function row_number() requires 
window to be ordered, please add ORDER BY clause. For example SELECT 
row_number()(value_expr) OVER (PARTITION BY window_partition ORDER BY 
window_ordering) from table

Time taken: 0.172 seconds, Fetched 1 row(s)

 

For better compatibility with migration. For better compatibility with 
migration, new parameters are added to ensure compatibility with the same 
behavior as Hive SQL

 



--
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