Skip to content

feat(bigframes): Transpiler supports more string ops - #17693

Merged
tswast merged 3 commits into
mainfrom
tbergeron_py_udf_fstrings
Aug 3, 2026
Merged

feat(bigframes): Transpiler supports more string ops#17693
tswast merged 3 commits into
mainfrom
tbergeron_py_udf_fstrings

Conversation

@TrevorBergeron

Copy link
Copy Markdown
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> 🦕

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

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.

Code Review

This pull request adds support for compiling f-strings, nullity checks (such as 'is None' and 'is not None'), and various string operations (e.g., capitalize, islower, isupper) in Python UDFs. Feedback is provided regarding the Polars compilation of 'IsLowerOp' and 'IsUpperOp', where the current regex patterns incorrectly require the entire string to consist only of letters, failing to match Python's native behavior which allows non-cased characters.

Comment thread packages/bigframes/bigframes/core/compile/polars/compiler.py Outdated
@TrevorBergeron
TrevorBergeron requested a review from sycai July 14, 2026 21:13
@TrevorBergeron
TrevorBergeron marked this pull request as ready for review July 14, 2026 21:13
@TrevorBergeron
TrevorBergeron requested review from a team as code owners July 14, 2026 21:13
return val


def _compile_bytecode_to_py_expr(func: Callable) -> expression.Expression:

@sycai sycai Jul 14, 2026

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.

(Not an action item in this PR) The length of this function is getting out of hand. We will probably need to break it up sometime in the future.

pd_result = pd.Series(
["Fruit: apple!", "Fruit: banana!", "Null value"], dtype="string"
)
assert_series_equal(bf_result, pd_result, check_dtype=False)

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.

style nit: please add empty lines between the "arange" "act" "assert" blocks to demarcate them, and apply the style to the rest of the changes too.

@tswast
tswast enabled auto-merge (squash) August 3, 2026 16:46
@tswast
tswast disabled auto-merge August 3, 2026 16:48
@tswast tswast closed this Aug 3, 2026
@tswast tswast reopened this Aug 3, 2026
@tswast
tswast requested a review from sycai August 3, 2026 18:14
@tswast
tswast enabled auto-merge (squash) August 3, 2026 18:17
@tswast
tswast disabled auto-merge August 3, 2026 18:17

@sycai sycai left a comment

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.

Approve PR now. We could do the clean up later

@tswast
tswast merged commit 7d2bc21 into main Aug 3, 2026
42 of 43 checks passed
@tswast
tswast deleted the tbergeron_py_udf_fstrings branch August 3, 2026 19:49
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.

3 participants