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

fix: regr_count now returns Uint64 #11731

Merged
merged 1 commit into from
Jul 30, 2024

Conversation

Michael-J-Ward
Copy link
Contributor

Which issue does this PR close?

Closes #11726.

Rationale for this change

Consistent with count expectations and postgres, regr_count aggregate function should return an integer, not a float.

What changes are included in this PR?

The UDAF and it's corresponding SQL tests have been updated.

Are these changes tested?

Yes, via updating the aggregate.slt tests.

Are there any user-facing changes?

Yes - regr_count returns a different DataType.

@github-actions github-actions bot added the sqllogictest SQL Logic Tests (.slt) label Jul 30, 2024
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Michael-J-Ward

I double checked and indeed this does match posgres semantics:

postgres=# create table foo(x int);
CREATE TABLE
postgres=# insert into foo values (1);
INSERT 0 1
postgres=# insert into foo values (2);
INSERT 0 1

postgres=# select pg_typeof(regr_count(x, x)), regr_count(x, x) from foo;
 pg_typeof | regr_count
-----------+------------
 bigint    |          2
(1 row)

Copy link
Contributor

@jayzhan211 jayzhan211 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes sense to me

@jayzhan211
Copy link
Contributor

Thanks @Michael-J-Ward and @alamb

@jayzhan211 jayzhan211 merged commit cd786e2 into apache:main Jul 30, 2024
24 checks passed
Michael-J-Ward added a commit to Michael-J-Ward/datafusion-python that referenced this pull request Aug 10, 2024
Michael-J-Ward added a commit to Michael-J-Ward/datafusion-python that referenced this pull request Aug 20, 2024
andygrove pushed a commit to apache/datafusion-python that referenced this pull request Aug 23, 2024
* update datafusion deps to point to githuc.com/apache/datafusion

Datafusion 41 is not yet released on crates.io.

* update TableProvider::scan

Ref: apache/datafusion#11516

* use SessionStateBuilder

The old constructor is deprecated.

Ref: apache/datafusion#11403

* update AggregateFunction

Upstream Changes:
- The field name was switched from `func_name` to func.
- AggregateFunctionDefinition was removed

Ref: apache/datafusion#11803

* update imports in catalog

Catlog API was extracted to a separate crate.

Ref: apache/datafusion#11516

* use appropriate path for approx_distinct

Ref: apache/datafusion#11644

* migrate AggregateExt to ExprFunctionExt

Also removed `sqlparser` dependency since it's re-exported upstream.

Ref: apache/datafusion#11550

* update regr_count tests for new return type

Ref: apache/datafusion#11731

* migrate from function-array to functions-nested

The package was renamed upstream.

Ref: apache/datafusion#11602

* cargo fmt

* lock datafusion deps to 41

* remove todo from cargo.toml

All the datafusion dependencies are re-exported, but I still need to figure out *why*.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

regr_count should return an int
3 participants