Skip to content

test_regr_funcs does not test datafusion-python functions #778

New issue

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

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

Already on GitHub? # to your account

Closed
Tracked by #776
Michael-J-Ward opened this issue Jul 25, 2024 · 0 comments · Fixed by #771
Closed
Tracked by #776

test_regr_funcs does not test datafusion-python functions #778

Michael-J-Ward opened this issue Jul 25, 2024 · 0 comments · Fixed by #771

Comments

@Michael-J-Ward
Copy link
Contributor

test_regr_funcs in test_functions.py uses a ctx.sql(query) statement, which bypasses the datafusion-python functions it should be testing.

def test_regr_funcs(df):
# test case base on
# https://github.com/apache/arrow-datafusion/blob/d1361d56b9a9e0c165d3d71a8df6795d2a5f51dd/datafusion/core/tests/sqllogictests/test_files/aggregate.slt#L2330
ctx = SessionContext()
result = ctx.sql(
"select regr_slope(1,1), regr_intercept(1,1), "
"regr_count(1,1), regr_r2(1,1), regr_avgx(1,1), "
"regr_avgy(1,1), regr_sxx(1,1), regr_syy(1,1), "
"regr_sxy(1,1);"
).collect()
assert result[0].column(0) == pa.array([None], type=pa.float64())
assert result[0].column(1) == pa.array([None], type=pa.float64())
assert result[0].column(2) == pa.array([1], type=pa.float64())
assert result[0].column(3) == pa.array([None], type=pa.float64())
assert result[0].column(4) == pa.array([1], type=pa.float64())
assert result[0].column(5) == pa.array([1], type=pa.float64())
assert result[0].column(6) == pa.array([0], type=pa.float64())
assert result[0].column(7) == pa.array([0], type=pa.float64())
assert result[0].column(8) == pa.array([0], type=pa.float64())

This was referenced Jul 25, 2024
Michael-J-Ward added a commit to Michael-J-Ward/datafusion-python that referenced this issue Jul 29, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant