Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand Test Coverage for ScalarUDF's #10595

Closed
berkaysynnada opened this issue May 21, 2024 · 1 comment · Fixed by #14307
Closed

Expand Test Coverage for ScalarUDF's #10595

berkaysynnada opened this issue May 21, 2024 · 1 comment · Fixed by #14307
Assignees
Labels
enhancement New feature or request

Comments

@berkaysynnada
Copy link
Contributor

berkaysynnada commented May 21, 2024

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

# 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

@buraksenn
Copy link
Contributor

take

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants