nuno-faria opened a new issue, #1765:
URL: https://github.com/apache/datafusion-python/issues/1765
**Describe the bug**
Using `df.sort(col)` orders nulls first, while DataFusion's default is to
order nulls last (see `datafusion.sql_parser.default_null_ordering`). Ordering
nulls last is also the behavior of `sort_by` and `ctx.sql("... order by ...")`.
**To Reproduce**
```python
import datafusion
ctx = datafusion.SessionContext()
ctx.sql("create table t (a int)").collect()
ctx.sql("insert into t values (1), (null), (3), (null), (2)").collect()
ctx.table("t").sort(datafusion.Expr.column("a")).show()
ctx.table("t").sort_by(datafusion.Expr.column("a")).show()
ctx.sql("select * from t order by a").show()
```
```
DataFrame()
+---+
| a |
+---+
| |
| |
| 1 |
| 2 |
| 3 |
+---+
DataFrame()
+---+
| a |
+---+
| 1 |
| 2 |
| 3 |
| |
| |
+---+
DataFrame()
+---+
| a |
+---+
| 1 |
| 2 |
| 3 |
| |
| |
+---+
```
**Expected behavior**
Follow the same behavior as the default.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]