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

FIX-#6778: Read parquet files without file extensions using fastparquet #6790

Merged
merged 2 commits into from
Dec 1, 2023

Conversation

seydar
Copy link
Contributor

@seydar seydar commented Nov 30, 2023

In supporting fastparquet, modin takes the paths provided, globs them, and filters them to only look at files with the .parq or .parquet extension. This commit adds support so that if the path supplied is explicitly a file, it will be included.

Signed-off by: Ari Brown [email protected]

What do these changes do?

If a a file is passed to modin.pandas.read_parquet(..., engine='fastparquet') but the file does not have ".parq" or ".parquet" in the name, it will be ignored when determining the number of partitions. This change looks at all of the paths passed, and if the path is a file, then it considers it to be a parquet file.

  • first commit message and PR title follow format outlined here

    NOTE: If you edit the PR title to match this format, you need to add another commit (even if it's empty) or amend your last commit for the CI job that checks the PR title to pick up the new PR title.

  • passes flake8 modin/ asv_bench/benchmarks scripts/doc_checker.py
  • passes black --check modin/ asv_bench/benchmarks scripts/doc_checker.py
  • signed commit with git commit -s
  • Resolves BUG: Unable to read parquet files using fastparquet #6778
  • tests added and passing
  • [N/A] module layout described at docs/development/architecture.rst is up-to-date

…ing fastparquet

In supporting fastparquet, modin takes the paths provided, globs them,
and filters them to only look at files with the .parq or .parquet
extension. This commit adds support so that if the path supplied is
explicitly a file, it will be included.

Signed-off by: Ari Brown <[email protected]>
# However, we also need to support users passing in explicit files that
# don't necessarily have the `.parq` or `.parquet` extension -- if a user
# says that a file is parquet, then we should probably give it a shot.
if os.path.isfile(self.path):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like os.path.isfile doesn't work with objects, for example S3File.

Suggested change
if os.path.isfile(self.path):
if self.fs.isfile(self.path):

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just made the change as an added commit. Thank you for the catch.

… a file

Avoids the use of `os.path.isfile()` to use `self.fs.isfile()`.

Signed-off-by: Ari Brown <[email protected]>
Copy link
Collaborator

@anmyachev anmyachev 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 @seydar!

@anmyachev anmyachev merged commit b8202f1 into modin-project:master Dec 1, 2023
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Unable to read parquet files using fastparquet
2 participants