I am running below query in spark.sql which has IN clause with order by statement
Here is my original data:
Query:
SELECT
*, ROW_NUMBER() OVER (PARTITION BY id ORDER BY category IN ('TV','laptop'), created_at desc) as rn
FROM table2
Result:
Can you help me to interpret this result? I have added 'TV' and 'laptop' in IN clause then it should be at top row (rn = 1 to 4)
I have observed same behaviour in Snowflake as well. After adding IN ('TV','laptop') in the query getting this unpredicted result.



