Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on May 7, 2026. It is now read-only.

feat: add support for np.isnan and np.isfinite ufuncs#2188

Merged
tswast merged 10 commits into
maingoogleapis/python-bigquery-dataframes:mainfrom
add-isnan-isfinitegoogleapis/python-bigquery-dataframes:add-isnan-isfiniteCopy head branch name to clipboard
Oct 24, 2025
Merged

feat: add support for np.isnan and np.isfinite ufuncs#2188
tswast merged 10 commits into
maingoogleapis/python-bigquery-dataframes:mainfrom
add-isnan-isfinitegoogleapis/python-bigquery-dataframes:add-isnan-isfiniteCopy head branch name to clipboard

Conversation

@tswast

@tswast tswast commented Oct 22, 2025

Copy link
Copy Markdown
Contributor

This commit implements the isnan and isfinite numpy ufuncs in bigframes.

The following changes were made:

  • Added IsNanOp and IsFiniteOp to bigframes/operations/numeric_ops.py
  • Mapped np.isnan and np.isfinite to the new ops in bigframes/operations/numpy_op_maps.py
  • Added compilation logic for the new ops to the ibis, polars, and sqlglot compilers
  • Added tests for the new ops in tests/system/small/test_numpy.py

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 b/454341854🦕

This commit implements the `isnan` and `isfinite` numpy ufuncs in bigframes.

The following changes were made:
- Added `IsNanOp` and `IsFiniteOp` to `bigframes/operations/numeric_ops.py`
- Mapped `np.isnan` and `np.isfinite` to the new ops in `bigframes/operations/numpy_op_maps.py`
- Added compilation logic for the new ops to the ibis, polars, and sqlglot compilers
- Added tests for the new ops in `tests/system/small/test_numpy.py`
@tswast tswast requested review from a team and TrevorBergeron October 22, 2025 18:18
@product-auto-label product-auto-label Bot added the size: m Pull request size is medium. label Oct 22, 2025
@product-auto-label product-auto-label Bot added the api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. label Oct 22, 2025
Comment thread bigframes/core/compile/ibis_compiler/scalar_op_compiler.py
google-labs-jules Bot and others added 2 commits October 22, 2025 18:31
This commit implements the `isnan` and `isfinite` numpy ufuncs in bigframes.

The following changes were made:
- Added `IsNanOrNullOp` and `IsFiniteOp` to `bigframes/operations/numeric_ops.py`
- Mapped `np.isnan` and `np.isfinite` to the new ops in `bigframes/operations/numpy_op_maps.py`
- Added compilation logic for the new ops to the ibis, polars, and sqlglot compilers
- Added tests for the new ops in `tests/system/small/test_numpy.py`
- Renamed `IsNanOp` to `IsNanOrNullOp` to match numpy semantics and updated compilers accordingly.
Comment thread bigframes/core/compile/ibis_compiler/scalar_op_compiler.py Outdated
Comment thread bigframes/core/compile/sqlglot/scalar_compiler.py Outdated
Comment thread bigframes/core/compile/sqlglot/scalar_compiler.py Outdated
Comment thread bigframes/core/compile/sqlglot/scalar_compiler.py Outdated
Comment thread bigframes/core/compile/sqlglot/scalar_compiler.py Outdated
Comment thread bigframes/core/compile/sqlglot/scalar_compiler.py Outdated
Comment thread bigframes/operations/numeric_ops.py Outdated
unsafe_pow_op = UnsafePowOp()

IsNanOp = base_ops.create_unary_op(
name="isnanornull",

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.

name?

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 in 7f1bca4, thanks.

@polars_compiler.register_op(numeric_ops.IsNanOp)
def is_nan_op_impl(
compiler: polars_compiler.PolarsExpressionCompiler,
op: numeric_ops.SqrtOp, # type: ignore

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.

type annotation

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 in 7f1bca4, thanks.

@polars_compiler.register_op(numeric_ops.IsFiniteOp)
def is_finite_op_impl(
compiler: polars_compiler.PolarsExpressionCompiler,
op: numeric_ops.SqrtOp, # type: ignore

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.

annotation

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 in 7f1bca4, thanks.

@tswast tswast merged commit 68723bc into main Oct 24, 2025
25 checks passed
@tswast tswast deleted the add-isnan-isfinite branch October 24, 2025 14:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.