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

chore: add experimental blob from_glob_path test #1406

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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 19, 2025
Merged
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
55 changes: 45 additions & 10 deletions 55 tests/system/small/blob/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,57 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import pandas as pd

import bigframes
import bigframes.pandas as bpd


def test_blob_create_from_uri_str():
def test_blob_create_from_uri_str(bq_connection: str, session: bigframes.Session):
bigframes.options.experiments.blob = True

uri_series = bpd.Series(
[
"gs://bigframes_blob_test/images/img0.jpg",
"gs://bigframes_blob_test/images/img1.jpg",
]
uris = [
"gs://bigframes_blob_test/images/img0.jpg",
"gs://bigframes_blob_test/images/img1.jpg",
]

uri_series = bpd.Series(uris, session=session)
blob_series = uri_series.str.to_blob(connection=bq_connection)

pd_blob_df = blob_series.struct.explode().to_pandas()
expected_pd_df = pd.DataFrame(
{
"uri": uris,
"version": [None, None],
"authorizer": [bq_connection.casefold(), bq_connection.casefold()],
"details": [None, None],
}
)

pd.testing.assert_frame_equal(
pd_blob_df, expected_pd_df, check_dtype=False, check_index_type=False
)
# TODO: use bq_connection fixture when MMD location capitalization fix is in prod
blob_series = uri_series.str.to_blob(connection="us.bigframes-default-connection")

pd_blob_series = blob_series.to_pandas()

assert len(pd_blob_series) == 2
def test_blob_create_from_glob_path(bq_connection: str, session: bigframes.Session):
bigframes.options.experiments.blob = True

blob_df = session.from_glob_path(
"gs://bigframes_blob_test/images/*", connection=bq_connection, name="blob_col"
)
pd_blob_df = blob_df["blob_col"].struct.explode().to_pandas()
expected_df = pd.DataFrame(
{
"uri": [
"gs://bigframes_blob_test/images/img0.jpg",
"gs://bigframes_blob_test/images/img1.jpg",
],
"version": [None, None],
"authorizer": [bq_connection.casefold(), bq_connection.casefold()],
"details": [None, None],
}
)

pd.testing.assert_frame_equal(
pd_blob_df, expected_df, check_dtype=False, check_index_type=False
)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.