-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem or challenge?
After merging PR #10504, a new file monotonicity.rs was introduced. This file contains rules for determining whether the output of functions created with the make_math_unary_udf and make_math_binary_udf macros preserves the order of the input. Currently, these rules are not covered by tests.
Describe the solution you'd like
We need to expand the test coverage to ensure that the order-preserving properties of these functions are correctly implemented and protected. We can add both unit and .slt tests.
Describe alternatives you've considered
No response
Additional context
An example test exists in order.slt
datafusion/datafusion/sqllogictest/test_files/order.slt
Lines 1077 to 1108 in f807947
| # ABS(x) preserves the ordering if x's range falls into positive values. | |
| # Since x is defined as INT UNSIGNED, its range is assumed to be from 0 to INF. | |
| statement ok | |
| CREATE EXTERNAL TABLE ordered_table ( | |
| a0 INT, | |
| a INT, | |
| b INT, | |
| c INT UNSIGNED, | |
| d INT | |
| ) | |
| STORED AS CSV | |
| WITH ORDER (c ASC) | |
| LOCATION '../core/tests/data/window_2.csv' | |
| OPTIONS ('format.has_header' 'true'); | |
| query TT | |
| EXPLAIN SELECT ABS(c) as abs_c | |
| FROM ordered_table | |
| ORDER BY abs_c | |
| limit 5; | |
| ---- | |
| logical_plan | |
| 01)Limit: skip=0, fetch=5 | |
| 02)--Sort: abs_c ASC NULLS LAST, fetch=5 | |
| 03)----Projection: abs(ordered_table.c) AS abs_c | |
| 04)------TableScan: ordered_table projection=[c] | |
| physical_plan | |
| 01)GlobalLimitExec: skip=0, fetch=5 | |
| 02)--SortPreservingMergeExec: [abs_c@0 ASC NULLS LAST], fetch=5 | |
| 03)----ProjectionExec: expr=[abs(c@0) as abs_c] | |
| 04)------RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=1 | |
| 05)--------CsvExec: file_groups={1 group: [[WORKSPACE_ROOT/datafusion/core/tests/data/window_2.csv]]}, projection=[c], output_ordering=[c@0 ASC NULLS LAST], has_header=true |
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request