Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix read parquet import error message #33361
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 read parquet import error message #33361
Changes from 9 commits
3d5d488
29bfc49
43de45f
bca4bd1
2bc7dd0
ed51950
7eb45b8
59a3877
c5fdadc
dd529c4
f348001
7d58483
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Looks like you're repeating the same twice for
pyarrow
andfastparquet
(which makes sense). But it'd probably be worth to just implement things once, and parametrize (with pytest).You can search for
@pytest.mark.parametrize
, and you'll find lots of examples of parametrized tests. The idea is that the test will receive a set of variables for each ofpyarrow
andfastparquet
, and pytest will execute it twice with each set of variables.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, I thought about parametrizing, but in this case it's tricky: the error message will only ever show up if both pyarrow and fastparquet are inadequately installed (i.e. not installed, or bad version installed). This is embodied in the conditional:
The
and
'ed conditions can't be decoupled. So we'd still need both the lines of code you highlight above.The only thing that could be de-duplicated with parametrization, is the contents of the
if
block. But even that doesn't feel quite right; it's just two aspects of the same situation.Maybe the best thing to do if we want to be absolutely strict, is to take all the boolean flagging that is currently in these two sections
and move it outside of the test function, to module level. And use
pytest.mark.skipif
(or one of those wacky fixtures that injectpytest.mark.skip
) to only run the test when we expect an error message.At this point, I'm going to ask: how important is it that we do it this way? Because I'm slowly running out of steam 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.
this test is kind of overkill , but ok.
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.
I see, didn't realize you need to know about both versions at the same time.
I think you could write this in a very compact way, if we create the
_HAVE_USABLE_PYARROW
... variables at the beginning of the file, like_HAVE_PYARROW
. Then the parametrization would be trivial. But not that important.Thanks for the work on 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.
Cool. I'm happy to come back to it later if someone sees this as adding value. Though I tend to agree with @jreback that we're bordering overkill. Anyhoo, I'm glad to have this closed before everything drops out of mental cache over Easter.
Cheers all for the good input!!