HyukjinKwon edited a comment on issue #25195: [SPARK-28288][SQL][PYTHON][TESTS] 
Convert and port 'window.sql' into …
URL: https://github.com/apache/spark/pull/25195#issuecomment-513076671
 
 
   @younggyuchun, do you know why it works with UDFs?
   
   ```diff
    -- !query 19
   -SELECT val, cate, row_number() OVER(PARTITION BY cate) FROM testData ORDER 
BY cate, val
   +SELECT udf(val), cate, row_number() OVER(PARTITION BY cate ORDER BY val) 
FROM testData ORDER BY cate, udf(val)
    -- !query 19 schema
   -struct<>
   +struct<CAST(udf(cast(val as string)) AS INT):int,cate:string,row_number() 
OVER (PARTITION BY cate ORDER BY val ASC NULLS FIRST ROWS BETWEEN UNBOUNDED 
PRECEDING AND CURRENT ROW):int>
    -- !query 19 output
   -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;
   +NULL   NULL    1
   +3      NULL    2
   +NULL   a       1
   +1      a       2
   +1      a       3
   +2      a       4
   +1      b       1
   +2      b       2
   +3      b       3
   ```

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

Reply via email to