-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Fix pd.read_orc raising AttributeError #40970
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 8 commits into
pandas-dev:master
from
amznero:gh40918-fix-import-pyarrow-orc-error
Apr 21, 2021
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
67a6e5b
BUG: Fix pd.read_orc raising AttributeError
0623037
PR comments
amznero e61629a
pre-commit
amznero 728d26d
add whatsnew
amznero ef76984
Merge branch 'master' into gh40918-fix-import-pyarrow-orc-error
amznero 8728848
add doc
amznero d0c34db
fix ref
amznero 2d665cd
PR comments
amznero 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
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
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.
I think the tests might fail without this, since orc doesn't import properly for certain OSes.
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.
Yes, it will raise some errors on Windows env.
But if add this line to
test_orc.py
, the test case can not find the bug mentioned in #40918, it just skips this test case.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.
Maybe try
pyarrow._orc
? (That's what it tries topyarrow.orc
tries to find for me on windows)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.
Sorry, let me re-describe the reason for deleting this line.
If the PyArrow package is installed from Conda,
pytest.importorskip("pyarrow.orc")
will successfully import pyarrow.orc module, so test_orc.py-Line143got = read_orc(inputfile).iloc[:10]
will works fine.But, AttributeError will be raised if the user uses
pd.read_orc
directly without importingpyarrow.orc
first. The test case failed to find this bug.Maybe we should keep
pytest.importorskip("pyarrow.orc")
and deletepytest.importorskip("pyarrow.orc")
. Then fix this bug in pandas/io/orc.py, and makepyarrow
be imported only once(discuss below).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.
Well, I am hypothesizing that the bug will reproduce since
pyarrow.orc
is not imported bypytest.importorskip(pyarrow._orc)
, and runningpytest.importorskip(pyarrow._orc)
will skip the test on Windows where pyarrow orc support is not present, as I think it ispyarrow._orc
where the orc stuff is actually implemented. I cannot verify this works, though.