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

chore: cleanup tpch execute #1374

Merged
merged 7 commits into from
Nov 14, 2024
Merged

Conversation

EdAbati
Copy link
Collaborator

@EdAbati EdAbati commented Nov 13, 2024

What type of PR is this? (check all applicable)

  • πŸ’Ύ Refactor
  • ✨ Feature
  • πŸ› Bug Fix
  • πŸ”§ Optimization
  • πŸ“ Documentation
  • βœ… Test
  • 🐳 Other

Related issues

Checklist

  • Code follows style guide (ruff)
  • Tests added
  • Documented the changes

If you have comments or can explain your changes, please do so below.

Inspired by #1348, I thought it would be handy if adding/removing backends from TPCH was a bit easier. With this change, adding/removing a key in the BACKEND_READ_FUNC_MAP dictionary would add/remove a backend from the test.

While refactoring this I found some duplicated (a path was present twice) and unused code (the read functions that I commented out). I hope that with this it would be easier to spot

The diff is big because I removed all the execute folder. I know that this is lower priority so don't feel like you have to review straight away, it can wait :)

CUSTOMER_PATH = DATA_DIR / "customer.parquet"

BACKEND_READ_FUNC_MAP = {
# "pandas": lambda x: pd.read_parquet(x, engine="pyarrow"), # noqa: ERA001
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

should we just remove these? I kept them because they were still in the dictionary

result.returncode == 0
), f"Script {script_path} failed with error: {result.stderr}"

@pytest.mark.parametrize("query_path", QUERIES_DIR.glob("q[1-9]*.py"))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

if this PR doesn't get merged, I think that at least we should have this parametrised :)

Copy link
Member

Choose a reason for hiding this comment

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

+1

Copy link
Member

@FBruzzesi FBruzzesi left a comment

Choose a reason for hiding this comment

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

I love this kind of refactors and simplifications! Thanks @EdAbati !

I left just one comment regarding enabling running dask since they fixed the issue, and from our side we adjusted given their suggestions

tpch/execute.py Outdated Show resolved Hide resolved
result.returncode == 0
), f"Script {script_path} failed with error: {result.stderr}"

@pytest.mark.parametrize("query_path", QUERIES_DIR.glob("q[1-9]*.py"))
Copy link
Member

Choose a reason for hiding this comment

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

+1

Copy link
Member

@FBruzzesi FBruzzesi left a comment

Choose a reason for hiding this comment

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

It's a +10 from me

DogsClapGIF

Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

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

awesome, much better, thanks both!

@MarcoGorelli MarcoGorelli merged commit d8d30d9 into narwhals-dev:main Nov 14, 2024
22 checks passed
@EdAbati EdAbati deleted the cleanup-tpch branch November 14, 2024 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants