This repository was archived by the owner on Apr 1, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 67
feat: add DefaultIndexKind.NULL to use as index_col in read_gbq*, creating an indexless DataFrame/Series
#662
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
aaa545b
feat: Support indexless dataframe/series
TrevorBergeron 7f11946
Merge remote-tracking branch 'github/main' into null_index
TrevorBergeron 9a5b212
fixes for kurt, skew, median
TrevorBergeron 0248150
fix unit tests
TrevorBergeron 26e2d4f
Merge remote-tracking branch 'github/main' into null_index
TrevorBergeron 16e292b
fix more issues
TrevorBergeron 5611a86
fix defaulting to primary key logic
TrevorBergeron 8caa068
Merge remote-tracking branch 'github/main' into null_index
TrevorBergeron ea9b120
fix tests
TrevorBergeron 88fc037
Merge remote-tracking branch 'github/main' into null_index
TrevorBergeron 27d6f47
many small changes
TrevorBergeron 75b1fd1
fix accidental null indexes and raising warning
TrevorBergeron 0b26bbb
Merge remote-tracking branch 'github/main' into null_index
TrevorBergeron 7142078
fix df quantile index
TrevorBergeron 7b5f4f6
Merge remote-tracking branch 'github/main' into null_index
TrevorBergeron bc28bd4
disable legacy pandas for some tests, add concat test
TrevorBergeron bd0aa12
fix series repr
TrevorBergeron 5efcc27
Update bigframes/session/__init__.py
TrevorBergeron 4b487e7
Update bigframes/core/rewrite.py
TrevorBergeron 3892241
Update bigframes/core/rewrite.py
TrevorBergeron 09af424
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] 1164faf
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] 8844f27
Merge branch 'null_index' of https://github.com/googleapis/python-big…
gcf-owl-bot[bot] 600d500
pr comments addressed
TrevorBergeron 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -98,12 +98,12 @@ def order_with(self, by: Tuple[order.OrderingExpression, ...]): | |
| self.root, self.columns, self.predicate, new_ordering, self.reverse_root | ||
| ) | ||
|
|
||
| def maybe_join( | ||
| def can_join( | ||
| self, right: SquashedSelect, join_def: join_defs.JoinDefinition | ||
| ) -> Optional[SquashedSelect]: | ||
| ) -> bool: | ||
| if join_def.type == "cross": | ||
| # Cannot convert cross join to projection | ||
| return None | ||
| return False | ||
|
|
||
| r_exprs_by_id = {id: expr for expr, id in right.columns} | ||
| l_exprs_by_id = {id: expr for expr, id in self.columns} | ||
|
|
@@ -113,10 +113,17 @@ def maybe_join( | |
| if (self.root != right.root) or any( | ||
| l_expr != r_expr for l_expr, r_expr in zip(l_join_exprs, r_join_exprs) | ||
| ): | ||
| return False | ||
| return True | ||
|
|
||
| def maybe_merge( | ||
| self, | ||
| right: SquashedSelect, | ||
| join_type: join_defs.JoinType, | ||
| mappings: Tuple[join_defs.JoinColumnMapping, ...], | ||
| ) -> Optional[SquashedSelect]: | ||
| if self.root != right.root: | ||
| return None | ||
|
|
||
| join_type = join_def.type | ||
|
|
||
| # Mask columns and remap names to expected schema | ||
| lselection = self.columns | ||
| rselection = right.columns | ||
|
|
@@ -136,7 +143,7 @@ def maybe_join( | |
| lselection = tuple((apply_mask(expr, lmask), id) for expr, id in lselection) | ||
| if rmask is not None: | ||
| rselection = tuple((apply_mask(expr, rmask), id) for expr, id in rselection) | ||
| new_columns = remap_names(join_def, lselection, rselection) | ||
| new_columns = remap_names(mappings, lselection, rselection) | ||
|
|
||
| # Reconstruct ordering | ||
| reverse_root = self.reverse_root | ||
|
|
@@ -201,20 +208,27 @@ def maybe_squash_projection(node: nodes.BigFrameNode) -> nodes.BigFrameNode: | |
| def maybe_rewrite_join(join_node: nodes.JoinNode) -> nodes.BigFrameNode: | ||
| left_side = SquashedSelect.from_node(join_node.left_child) | ||
| right_side = SquashedSelect.from_node(join_node.right_child) | ||
| joined = left_side.maybe_join(right_side, join_node.join) | ||
| if joined is not None: | ||
| return joined.expand() | ||
| if left_side.can_join(right_side, join_node.join): | ||
| merged = left_side.maybe_merge( | ||
| right_side, join_node.join.type, join_node.join.mappings | ||
| ) | ||
| assert ( | ||
| merged is not None | ||
| ), "Couldn't merge nodes. This shouldn't happen. Please share full stacktrace with the BigQuery DataFrames team at [email protected]." | ||
| return merged.expand() | ||
| else: | ||
| return join_node | ||
|
|
||
|
|
||
| def remap_names( | ||
| join: join_defs.JoinDefinition, lselection: Selection, rselection: Selection | ||
| mappings: Tuple[join_defs.JoinColumnMapping, ...], | ||
| lselection: Selection, | ||
| rselection: Selection, | ||
| ) -> Selection: | ||
| new_selection: Selection = tuple() | ||
| l_exprs_by_id = {id: expr for expr, id in lselection} | ||
| r_exprs_by_id = {id: expr for expr, id in rselection} | ||
| for mapping in join.mappings: | ||
| for mapping in mappings: | ||
| if mapping.source_table == join_defs.JoinSide.LEFT: | ||
| expr = l_exprs_by_id[mapping.source_id] | ||
| else: # Right | ||
|
|
||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.