alamb commented on a change in pull request #1344:
URL: https://github.com/apache/arrow-datafusion/pull/1344#discussion_r753680388
##########
File path: datafusion/tests/sql.rs
##########
@@ -5999,3 +5999,75 @@ async fn test_expect_distinct() -> Result<()> {
assert_batches_eq!(expected, &actual);
Ok(())
}
+
+#[tokio::test]
+async fn test_nulls_first_asc() -> Result<()> {
+ let mut ctx = ExecutionContext::new();
+ let sql = "SELECT * FROM (VALUES (1, 'one'), (2, 'two'), (null, 'three'))
AS t (num,letter) ORDER BY num";
+ let actual = execute_to_batches(&mut ctx, sql).await;
+ let expected = vec![
+ "+-----+--------+",
+ "| num | letter |",
+ "+-----+--------+",
+ "| 1 | one |",
+ "| 2 | two |",
+ "| | three |",
+ "+-----+--------+",
+ ];
+ assert_batches_eq!(expected, &actual);
+ Ok(())
+}
+
+#[tokio::test]
+async fn test_nulls_first_desc() -> Result<()> {
+ let mut ctx = ExecutionContext::new();
+ let sql = "SELECT * FROM (VALUES (1, 'one'), (2, 'two'), (null, 'three'))
AS t (num,letter) ORDER BY num DESC";
+ let actual = execute_to_batches(&mut ctx, sql).await;
+ let expected = vec![
+ "+-----+--------+",
+ "| num | letter |",
+ "+-----+--------+",
+ "| | three |",
+ "| 2 | two |",
+ "| 1 | one |",
+ "+-----+--------+",
+ ];
+ assert_batches_eq!(expected, &actual);
Review comment:
👍
--
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]