Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ def _convert_to_nonnull_string(column: ibis_types.Value) -> ibis_types.StringVal
result = ibis_ops.ToJsonString(column).to_expr() # type: ignore
# Escape backslashes and use backslash as delineator
escaped = cast(
ibis_types.StringColumn,
result.fill_null(ibis_types.literal(""))
if hasattr(result, "fill_null")
else result.fillna(""),
ibis_types.StringColumn, result.fill_null(ibis_types.literal(""))
).replace(
"\\", # type: ignore
"\\\\", # type: ignore
Expand Down
12 changes: 6 additions & 6 deletions bigframes/core/compile/ibis_compiler/scalar_op_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import pandas as pd

from bigframes.core.compile.constants import UNIT_TO_US_CONVERSION_FACTORS
import bigframes.core.compile.default_ordering
import bigframes.core.compile.ibis_compiler.default_ordering
from bigframes.core.compile.ibis_compiler.scalar_op_compiler import (
scalar_op_compiler, # TODO(tswast): avoid import of variables
)
Expand Down Expand Up @@ -1064,7 +1064,7 @@ def isin_op_impl(x: ibis_types.Value, op: ops.IsInOp):
if op.match_nulls and contains_nulls:
return x.isnull() | x.isin(matchable_ibis_values)
else:
return x.isin(matchable_ibis_values).fillna(False)
return x.isin(matchable_ibis_values).fill_null(ibis.literal(False))


@scalar_op_compiler.register_unary_op(ops.ToDatetimeOp, pass_op=True)
Expand Down Expand Up @@ -1383,8 +1383,8 @@ def eq_nulls_match_op(
left = x.cast(ibis_dtypes.str).fill_null(literal)
right = y.cast(ibis_dtypes.str).fill_null(literal)
else:
left = x.cast(ibis_dtypes.str).fillna(literal)
right = y.cast(ibis_dtypes.str).fillna(literal)
left = x.cast(ibis_dtypes.str).fill_null(literal)
right = y.cast(ibis_dtypes.str).fill_null(literal)

return left == right

Expand Down Expand Up @@ -1813,7 +1813,7 @@ def fillna_op(
if hasattr(x, "fill_null"):
return x.fill_null(typing.cast(ibis_types.Scalar, y))
else:
return x.fillna(typing.cast(ibis_types.Scalar, y))
return x.fill_null(typing.cast(ibis_types.Scalar, y))


@scalar_op_compiler.register_binary_op(ops.round_op)
Expand Down Expand Up @@ -2016,7 +2016,7 @@ def _construct_prompt(

@scalar_op_compiler.register_nary_op(ops.RowKey, pass_op=True)
def rowkey_op_impl(*values: ibis_types.Value, op: ops.RowKey) -> ibis_types.Value:
return bigframes.core.compile.default_ordering.gen_row_key(values)
return bigframes.core.compile.ibis_compiler.default_ordering.gen_row_key(values)


# Helpers
Expand Down
6 changes: 0 additions & 6 deletions bigframes/session/_io/bigquery/read_gbq_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,9 @@
import google.api_core.exceptions
import google.cloud.bigquery as bigquery

import bigframes.clients
import bigframes.core.compile
import bigframes.core.compile.default_ordering
import bigframes.core.sql
import bigframes.dtypes
import bigframes.exceptions as bfe
import bigframes.session._io.bigquery
import bigframes.session.clients
import bigframes.version

# Avoid circular imports.
if typing.TYPE_CHECKING:
Expand Down
7 changes: 5 additions & 2 deletions tests/unit/test_notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import pathlib

import os.path
REPO_ROOT = pathlib.Path(__file__).parent.parent.parent


def test_template_notebook_exists():
# This notebook is meant for being used as a BigFrames usage template and
# could be dynamically linked in places such as BQ Studio and IDE extensions.
# Let's make sure it exists in the well known path.
assert os.path.exists("notebooks/getting_started/bq_dataframes_template.ipynb")
assert (
REPO_ROOT / "notebooks" / "getting_started" / "bq_dataframes_template.ipynb"
).exists()