Skip to content

feat: create Series.bigquery.function_name accessors for array and AEAD functions#17279

Open
tswast wants to merge 9 commits into
mainfrom
tswast-gen-pandas-accessors
Open

feat: create Series.bigquery.function_name accessors for array and AEAD functions#17279
tswast wants to merge 9 commits into
mainfrom
tswast-gen-pandas-accessors

Conversation

@tswast
Copy link
Copy Markdown
Contributor

@tswast tswast commented May 27, 2026

🦕

@tswast tswast requested review from a team as code owners May 27, 2026 20:53
@tswast tswast requested review from GarrettWu and removed request for a team May 27, 2026 20:53
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces BigQuery Series accessors for both BigFrames and pandas Series, allowing users to call BigQuery-specific functions (such as array and AEAD encryption operations) directly on Series objects. It updates the code generation script and adds Jinja templates to generate the core, BigFrames, and pandas Series accessor classes, along with registering the new bigquery accessor and adding comprehensive unit tests. The code review feedback points out missing imports of bigframes.session in the generated templates which could cause runtime errors, and suggests using the existing OUTPUT_DIR global variable in the generator script instead of hardcoding path strings to improve maintainability.

Comment thread packages/bigframes/scripts/templates/core_series_accessor.py.j2
Comment thread packages/bigframes/scripts/templates/pandas_series_accessor.py.j2
Comment on lines +539 to +543
core_output_file = pathlib.Path("bigframes/extensions/core/series_accessor.py")
core_output_file.parent.mkdir(parents=True, exist_ok=True)
ensure_init_py(
core_output_file.parent, pathlib.Path("bigframes"), templates["license"]
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Instead of hardcoding the "bigframes" path string, use the existing OUTPUT_DIR global variable. This improves maintainability and ensures consistency with other file generation paths in the script. Additionally, ensure that you manually verify the diffs of the generated output against established golden files to prevent unintended regressions.

Suggested change
core_output_file = pathlib.Path("bigframes/extensions/core/series_accessor.py")
core_output_file.parent.mkdir(parents=True, exist_ok=True)
ensure_init_py(
core_output_file.parent, pathlib.Path("bigframes"), templates["license"]
)
core_output_file = OUTPUT_DIR.joinpath("extensions/core/series_accessor.py")
core_output_file.parent.mkdir(parents=True, exist_ok=True)
ensure_init_py(
core_output_file.parent, OUTPUT_DIR, templates["license"]
)
References
  1. When modifying code generation logic, manually verify the diffs of the generated output against established golden files to ensure that changes are deterministic and do not introduce unintended regressions.

Comment on lines +554 to +558
bf_output_file = pathlib.Path("bigframes/extensions/bigframes/series_accessor.py")
bf_output_file.parent.mkdir(parents=True, exist_ok=True)
ensure_init_py(
bf_output_file.parent, pathlib.Path("bigframes"), templates["license"]
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Instead of hardcoding the "bigframes" path string, use the existing OUTPUT_DIR global variable. This improves maintainability and ensures consistency with other file generation paths in the script. Additionally, ensure that you manually verify the diffs of the generated output against established golden files to prevent unintended regressions.

Suggested change
bf_output_file = pathlib.Path("bigframes/extensions/bigframes/series_accessor.py")
bf_output_file.parent.mkdir(parents=True, exist_ok=True)
ensure_init_py(
bf_output_file.parent, pathlib.Path("bigframes"), templates["license"]
)
bf_output_file = OUTPUT_DIR.joinpath("extensions/bigframes/series_accessor.py")
bf_output_file.parent.mkdir(parents=True, exist_ok=True)
ensure_init_py(
bf_output_file.parent, OUTPUT_DIR, templates["license"]
)
References
  1. When modifying code generation logic, manually verify the diffs of the generated output against established golden files to ensure that changes are deterministic and do not introduce unintended regressions.

Comment on lines +569 to +573
pd_output_file = pathlib.Path("bigframes/extensions/pandas/series_accessor.py")
pd_output_file.parent.mkdir(parents=True, exist_ok=True)
ensure_init_py(
pd_output_file.parent, pathlib.Path("bigframes"), templates["license"]
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Instead of hardcoding the "bigframes" path string, use the existing OUTPUT_DIR global variable. This improves maintainability and ensures consistency with other file generation paths in the script. Additionally, ensure that you manually verify the diffs of the generated output against established golden files to prevent unintended regressions.

Suggested change
pd_output_file = pathlib.Path("bigframes/extensions/pandas/series_accessor.py")
pd_output_file.parent.mkdir(parents=True, exist_ok=True)
ensure_init_py(
pd_output_file.parent, pathlib.Path("bigframes"), templates["license"]
)
pd_output_file = OUTPUT_DIR.joinpath("extensions/pandas/series_accessor.py")
pd_output_file.parent.mkdir(parents=True, exist_ok=True)
ensure_init_py(
pd_output_file.parent, OUTPUT_DIR, templates["license"]
)
References
  1. When modifying code generation logic, manually verify the diffs of the generated output against established golden files to ensure that changes are deterministic and do not introduce unintended regressions.

@tswast tswast requested a review from a team as a code owner May 27, 2026 21:15
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oops. I should revert these changes. Bad merge.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

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.

1 participant