The spark connector ignores the NULLS FIRST or NULLS LAST part of the order by clause when the query is pushed down to Snowflake. Also, for Snowflake NULL values are considered to be higher than any non-NULL values, which is the opposite as spark. This makes null ordering non-coherent between both.
Here is a reproducible example, on Databricks with DBR 12,2:
The spark connector ignores the
NULLS FIRST
orNULLS LAST
part of the order by clause when the query is pushed down to Snowflake. Also, for Snowflake NULL values are considered to be higher than any non-NULL values, which is the opposite as spark. This makes null ordering non-coherent between both. Here is a reproducible example, on Databricks with DBR 12,2:Expected output:
Observed output: