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

Minor: Improve arrow_statistics tests #10927

Merged
merged 1 commit into from
Jun 16, 2024
Merged

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Jun 15, 2024

Which issue does this PR close?

Part of #10922

Rationale for this change

I thought of a way to make the tests easier to write -- which will be important as we start expanding out the test coverage

What changes are included in this PR?

Add an enum to make more explicit what is being testsed

Are these changes tested?

Only tests

Are there any user-facing changes?

No

cc @marvinlanhenke

@github-actions github-actions bot added the core Core DataFusion crate label Jun 15, 2024
@@ -164,6 +164,36 @@ impl TestReader {
}
}

/// Which statistics should we check?
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is easier to understand (and now it is at least documented why sometimes the page stats are the same and some they are different)

assert_eq!(
&row_counts, &expected_row_counts,
"{column_name}: Mismatch with expected row counts. \
Actual: {row_counts:?}. Expected: {expected_row_counts:?}"
);
} else {
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The code can now check either or both types of statistics

// row counts are [5, 5, 5, 5]
expected_row_counts: UInt64Array::from(vec![5, 5, 5, 5]),
column_name: "i64",
check: Check::Both,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought Both was easier to understand here than the loop -- and will be a better pattern to follow to add supprot for other types

Copy link
Contributor

@comphead comphead left a comment

Choose a reason for hiding this comment

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

lgtm thanks @alamb
the enum Both probably will require modifications though if there is more Check variants in future

Copy link
Member

@Weijun-H Weijun-H left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @alamb

Copy link
Contributor

@marvinlanhenke marvinlanhenke left a comment

Choose a reason for hiding this comment

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

thanks lgtm

@alamb alamb merged commit 648c20c into apache:main Jun 16, 2024
23 checks passed
@alamb
Copy link
Contributor Author

alamb commented Jun 16, 2024

Thanks everyone for the reviews

@alamb alamb deleted the alamb/better_tests branch June 16, 2024 11:37
findepi pushed a commit to findepi/datafusion that referenced this pull request Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core DataFusion crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants