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 69
chore: refactor IsNullOp and NotNullOp logic to make scalar ops generation easier #1822
Merged
Merged
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
30e1eb6
Refactor IsNullOp and NotNullOp logic
google-labs-jules[bot] 92870fd
Merge remote-tracking branch 'origin/main' into refactor-isnull-op
tswast 1b711aa
fix circular imports
tswast 7ede976
Merge remote-tracking branch 'origin/main' into refactor-isnull-op
tswast 9c17725
bad merge
tswast 78e4585
fix local pytest
tswast 333f9e2
Merge branch 'main' into refactor-isnull-op
tswast 53e0a3e
dont construct polars compiler if no polars
tswast 65e9fd4
Merge remote-tracking branch 'origin/refactor-isnull-op' into refacto…
tswast 360edb3
Merge remote-tracking branch 'origin/main' into refactor-isnull-op
tswast 9cd1fde
limit scope to just splitting large files
tswast ec47c37
Update bigframes/core/compile/compiled.py
tswast a475b72
Merge branch 'main' into refactor-isnull-op
tswast 5990732
Merge branch 'main' into refactor-isnull-op
tswast 8adafdd
Merge remote-tracking branch 'origin/main' into refactor-isnull-op
tswast b1cf81c
revert unneeded circular import workaround
tswast 57c1c98
Merge branch 'main' into refactor-isnull-op
tswast de5a12c
Merge remote-tracking branch 'origin/main' into refactor-isnull-op
tswast 87fd788
combine null ops into generic_ops files
tswast 6372a23
revert expression change
tswast ef06d65
Update bigframes/core/compile/polars/operations/__init__.py
tswast 7c19d8b
skip polars test for old polars
tswast 3d50dae
Merge remote-tracking branch 'origin/refactor-isnull-op' into refacto…
tswast 7babc87
Update bigframes/core/compile/ibis_compiler/operations/__init__.py
tswast aa5c47d
add minversion to skips
tswast b56cbbd
Merge remote-tracking branch 'origin/refactor-isnull-op' into refacto…
tswast 0c9802d
more skips
tswast a9152ba
Merge remote-tracking branch 'origin/main' into refactor-isnull-op
tswast c2f1ca8
fix minimum polars version detection
tswast 863b8ed
update colab constraints
tswast f42800e
skip polars on 3.10
tswast 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
|
tswast marked this conversation as resolved.
Outdated
|
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 |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| # Copyright 2023 Google LLC | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import typing | ||
|
|
||
| # Direct imports from bigframes | ||
| from bigframes import dtypes | ||
| from bigframes.operations import base_ops | ||
| import bigframes.operations.type as op_typing | ||
|
|
||
| # Imports for Ibis compilation | ||
| from bigframes_vendored.ibis.expr import types as ibis_types | ||
|
|
||
| # Imports for Polars compilation | ||
| try: | ||
| import polars as pl | ||
| except ImportError: | ||
| # Polars is optional, error will be raised elsewhere if user tries to use it. | ||
| pass | ||
|
|
||
|
|
||
| # Definitions of IsNullOp and NotNullOp operations | ||
| IsNullOp = base_ops.create_unary_op( | ||
| name="isnull", | ||
| type_signature=op_typing.FixedOutputType( | ||
| lambda x: True, dtypes.BOOL_DTYPE, description="nullable" | ||
| ), | ||
| ) | ||
| isnull_op = IsNullOp() | ||
|
|
||
| NotNullOp = base_ops.create_unary_op( | ||
| name="notnull", | ||
| type_signature=op_typing.FixedOutputType( | ||
| lambda x: True, dtypes.BOOL_DTYPE, description="nullable" | ||
| ), | ||
| ) | ||
| notnull_op = NotNullOp() | ||
|
|
||
| # Ibis Scalar Op Implementations | ||
| def _ibis_isnull_op_impl(x: ibis_types.Value): | ||
| return x.isnull() | ||
|
|
||
| def _ibis_notnull_op_impl(x: ibis_types.Value): | ||
| return x.notnull() | ||
|
|
||
|
|
||
| # Polars Expression Implementations | ||
| def _polars_isnull_op_impl(op: IsNullOp, input: pl.Expr) -> pl.Expr: | ||
| return input.is_null() | ||
|
|
||
| def _polars_notnull_op_impl(op: NotNullOp, input: pl.Expr) -> pl.Expr: | ||
| return input.is_not_null() | ||
|
|
||
| __all__ = [ | ||
| "IsNullOp", | ||
| "isnull_op", | ||
| "NotNullOp", | ||
| "notnull_op", | ||
| "_ibis_isnull_op_impl", | ||
| "_ibis_notnull_op_impl", | ||
| "_polars_isnull_op_impl", | ||
| "_polars_notnull_op_impl", | ||
| ] |
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.