-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
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
Merged
jreback
merged 12 commits into
pandas-dev:master
from
jfcorbett:fix-read-parquet-import-error-message
Apr 8, 2020
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
3d5d488
Collect import error messages and display them
jfcorbett 29bfc49
black
jfcorbett 43de45f
Merge remote-tracking branch 'upstream/master' into fix-read-parquet-…
jfcorbett bca4bd1
Placate mypy who insists that "ImportError" has no attribute "msg"
jfcorbett 2bc7dd0
Rename variables
jfcorbett ed51950
Apply suggestions from code review
jfcorbett 7eb45b8
Refactor extract variable joined_error_messages
jfcorbett 59a3877
Add test for get_engine(engine="auto") error messages
jfcorbett c5fdadc
Merge remote-tracking branch 'upstream/master' into fix-read-parquet-…
jfcorbett dd529c4
Rename
jfcorbett f348001
Refactor collection of error messages: use string instead of list
jfcorbett 7d58483
Merge remote-tracking branch 'upstream/master' into fix-read-parquet-…
jfcorbett File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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!!