Skip to content

Commit 985bbbf

Browse files
Ordering tests on dictionary types (#26834)
## Which issue does this PR close? - closes #4649 <!-- We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123. --> Adds tests for #4649 to ensure no regressions ## Rationale for this change ## What changes are included in this PR? New slt tests on a dictionary column that cover all permutations of ASC/DESC and nulls FIRST/LAST ## What is the testing strategy for this PR? New tests for a previously reported bug that has already been fixed but we didnt have coverage to ensure we dont regress. ## Are there any user-facing changes? No
1 parent d48480e commit 985bbbf

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

‎datafusion/sqllogictest/test_files/dictionary.slt‎

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,3 +674,56 @@ SELECT min(dict_of_ree), max(dict_of_ree), arrow_typeof(max(dict_of_ree)) FROM d
674674

675675
statement ok
676676
DROP TABLE dict_encoded_values;
677+
678+
##########
679+
## Sorting tests: ORDER BY on dictionary columns with NULLS FIRST / NULLS LAST
680+
##########
681+
682+
statement ok
683+
CREATE TABLE dict_nulls_order AS
684+
SELECT arrow_cast(v, 'Dictionary(Int32, Utf8)') AS d
685+
FROM (VALUES ('b'), (NULL), ('a'), ('c'), (NULL)) AS x(v);
686+
687+
query T
688+
SELECT arrow_typeof(d) FROM dict_nulls_order LIMIT 1;
689+
----
690+
Dictionary(Int32, Utf8)
691+
692+
query T
693+
SELECT d FROM dict_nulls_order ORDER BY d ASC NULLS FIRST;
694+
----
695+
NULL
696+
NULL
697+
a
698+
b
699+
c
700+
701+
query T
702+
SELECT d FROM dict_nulls_order ORDER BY d ASC NULLS LAST;
703+
----
704+
a
705+
b
706+
c
707+
NULL
708+
NULL
709+
710+
query T
711+
SELECT d FROM dict_nulls_order ORDER BY d DESC NULLS FIRST;
712+
----
713+
NULL
714+
NULL
715+
c
716+
b
717+
a
718+
719+
query T
720+
SELECT d FROM dict_nulls_order ORDER BY d DESC NULLS LAST;
721+
----
722+
c
723+
b
724+
a
725+
NULL
726+
NULL
727+
728+
statement ok
729+
DROP TABLE dict_nulls_order;

0 commit comments

Comments
 (0)