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

feat: (Series|DataFrame).explode #556

Merged
merged 8 commits into from
Apr 4, 2024
Merged

Conversation

chelsea-lin
Copy link
Contributor

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> 🦕

@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. labels Apr 1, 2024
@chelsea-lin chelsea-lin force-pushed the main_chelsealin_explode branch from 475eeea to 9a56bb5 Compare April 2, 2024 04:38
@product-auto-label product-auto-label bot added size: l Pull request size is large. and removed size: m Pull request size is medium. labels Apr 2, 2024
@chelsea-lin chelsea-lin marked this pull request as ready for review April 2, 2024 05:18
@chelsea-lin chelsea-lin requested review from a team as code owners April 2, 2024 05:18
Comment on lines 789 to 793
zip_array = (
table_w_offset[offset_array_id]
.zip(*[table_w_offset[column_id] for column_id in column_ids])
.name(zip_array_id)
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Have you tried directly indexing using the offsets rather than zipping? I'm worried compiling this creates an extra correlated JOIN.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! The new logical has a better performance!

),
],
)
def test_series_explode(data):
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if any of these tests use the unordered path. Maybe use to_pandas(ordered=False) for a test or two? Also for unordered test cases make sure not to ignore index as resetting the index will invoke the ordered 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.

It looks dtype validation will trigger the unordered path. Also I added the aggregation and to_pandas(ordered=False) as you suggested. Thanks!

@chelsea-lin chelsea-lin force-pushed the main_chelsealin_explode branch from b648bdb to 9aef5a3 Compare April 3, 2024 21:02
Copy link
Contributor

@TrevorBergeron TrevorBergeron left a comment

Choose a reason for hiding this comment

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

LGTM

@chelsea-lin chelsea-lin merged commit 9e32f57 into main Apr 4, 2024
16 checks passed
@chelsea-lin chelsea-lin deleted the main_chelsealin_explode branch April 4, 2024 16:42
Genesis929 pushed a commit that referenced this pull request Apr 9, 2024
* feat: (Series|DataFrame).explode

* fixing schema and adding tests

* fixing multi-index tests

* add docs and fix tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. size: l Pull request size is large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants