-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
DataFrame count method #5071
DataFrame count method #5071
Conversation
datafusion/core/src/dataframe.rs
Outdated
/// # Ok(()) | ||
/// # } | ||
/// ``` | ||
pub async fn len(self) -> Result<usize> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, could it be count
? For DataFrame-like API (pandas, Spark, etc.), there is commonly count
for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah that makes sense, changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Jefffrey. Could you also update the user guide?
clippy failures can be fixed by merging latest from master |
Benchmark runs are scheduled for baseline = 7d2318b and contender = a780a0b. a780a0b is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
let rows = self | ||
.aggregate( | ||
vec![], | ||
vec![datafusion_expr::count(Expr::Literal(ScalarValue::Null))], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was actually working by accident as a result of a quirk of NullArray whereby it doesn't have a null buffer despite all values being null. The count reported by this query should be 0 as only non-null values are counted.
Which issue does this PR close?
Closes #1926.
Rationale for this change
What changes are included in this PR?
New
count()
method on DataFrameAre these changes tested?
New unit test
Are there any user-facing changes?