Skip to content

fix: remove warnings for null index and partial ordering mode in prep for GA #1431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 26, 2025
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
4 changes: 0 additions & 4 deletions bigframes/core/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
import bigframes.core.utils as utils
import bigframes.core.window_spec as windows
import bigframes.dtypes
import bigframes.exceptions as bfe
import bigframes.features
import bigframes.operations as ops
import bigframes.operations.aggregations as agg_ops
Expand Down Expand Up @@ -137,9 +136,6 @@ def __init__(
f"'index_columns' (size {len(index_columns)}) and 'index_labels' (size {len(index_labels)}) must have equal length"
)

if len(index_columns) == 0:
msg = "Creating object with Null Index. Null Index is a preview feature."
warnings.warn(msg, category=bfe.NullIndexPreviewWarning)
self._index_columns = tuple(index_columns)
# Index labels don't need complicated hierarchical access so can store as tuple
self._index_labels = (
Expand Down
10 changes: 8 additions & 2 deletions bigframes/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,21 @@ class PreviewWarning(Warning):


class NullIndexPreviewWarning(PreviewWarning):
"""Null index feature is in preview."""
"""Unused. Kept for backwards compatibility.

Was used when null index feature was in preview.
"""


class NullIndexError(ValueError):
"""Object has no index."""


class OrderingModePartialPreviewWarning(PreviewWarning):
"""Ordering mode 'partial' is in preview."""
"""Unused. Kept for backwards compatibility.

Was used when ordering mode 'partial' was in preview.
"""


class OrderRequiredError(ValueError):
Expand Down
4 changes: 0 additions & 4 deletions bigframes/session/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,6 @@ def __init__(
# Whether this session treats objects as totally ordered.
# Will expose as feature later, only False for internal testing
self._strictly_ordered: bool = context.ordering_mode != "partial"
if not self._strictly_ordered:
msg = "Partial ordering mode is a preview feature and is subject to change."
warnings.warn(msg, bfe.OrderingModePartialPreviewWarning)

self._allow_ambiguity = not self._strictly_ordered
self._default_index_type = (
bigframes.enums.DefaultIndexKind.SEQUENTIAL_INT64
Expand Down
10 changes: 1 addition & 9 deletions notebooks/dataframes/index_col_null.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,15 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"id": "96757c59-fc22-420e-a42f-c6cb956110ec",
"metadata": {},
"outputs": [],
"source": [
"import warnings\n",
"\n",
"import bigframes.enums\n",
"import bigframes.exceptions\n",
"import bigframes.pandas as bpd\n",
"\n",
"# Explicitly opt-in to the NULL index preview feature.\n",
"warnings.simplefilter(\n",
" \"ignore\",\n",
" bigframes.exceptions.NullIndexPreviewWarning,\n",
")\n",
"\n",
"df = bpd.read_gbq(\n",
" \"bigquery-public-data.baseball.schedules\",\n",
" index_col=bigframes.enums.DefaultIndexKind.NULL,\n",
Expand Down
28 changes: 1 addition & 27 deletions notebooks/dataframes/pypi.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,7 @@
"source": [
"# Analyzing package downloads from PyPI with BigQuery DataFrames\n",
"\n",
"In this notebook, you'll use the [PyPI public dataset](https://console.cloud.google.com/marketplace/product/gcp-public-data-pypi/pypi) and the [deps.dev public dataset](https://deps.dev/) to visualize Python package downloads for a package and its dependencies.\n",
"\n",
"> **⚠ Important**\n",
">\n",
"> You'll use features that are currently in [preview](https://cloud.google.com/blog/products/gcp/google-cloud-gets-simplified-product-launch-stages): `ordering_mode=\"partial\"` and \"NULL\" indexes. There may be breaking changes to this functionality in future versions of the BigQuery DataFrames package.\n",
"\n"
"In this notebook, you'll use the [PyPI public dataset](https://console.cloud.google.com/marketplace/product/gcp-public-data-pypi/pypi) and the [deps.dev public dataset](https://deps.dev/) to visualize Python package downloads for a package and its dependencies."
]
},
{
Expand All @@ -59,27 +54,6 @@
"bpd.options.bigquery.ordering_mode = \"partial\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Filter out the relevant warnings for preview features used."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"import warnings\n",
"\n",
"import bigframes.exceptions\n",
"\n",
"warnings.simplefilter(\"ignore\", category=bigframes.exceptions.NullIndexPreviewWarning)\n",
"warnings.simplefilter(\"ignore\", category=bigframes.exceptions.OrderingModePartialPreviewWarning)"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down