-
Notifications
You must be signed in to change notification settings - Fork 94
feat: Add a parquet uuid calculation #3440
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
Changes from 3 commits
edd06ee
667de50
eab037d
b9db5a3
350e350
dca9c8c
796e25b
b5a1cdb
eeea299
b12eb18
47da681
9fd67b8
c1a0da4
b4f128c
761934a
fae5dde
55f840e
1982504
6f57cec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward/blob/main/LICENSE | ||
|
||
from __future__ import annotations | ||
|
||
import pathlib | ||
|
||
import pytest | ||
|
||
import awkward | ||
|
||
metadata_from_parquet_submodule = pytest.importorskip( | ||
"awkward.operations.ak_metadata_from_parquet" | ||
) | ||
metadata_from_parquet = metadata_from_parquet_submodule.metadata_from_parquet | ||
|
||
SAMPLES_DIR = pathlib.Path(__file__).parent / "samples" | ||
input = SAMPLES_DIR / "nullable-record-primitives.parquet" | ||
|
||
|
||
def test_parquet_uuid(): | ||
meta = metadata_from_parquet(input) | ||
Check failure on line 21 in tests/test_3440_calculate_parquet_uuid.py
|
||
assert ( | ||
Check failure on line 22 in tests/test_3440_calculate_parquet_uuid.py
|
||
meta["uuid"] | ||
== "93fd596534251b1ac750f359d9d55418b02bcddcc79cd5ab1e3d9735941fbcae" | ||
) | ||
|
||
|
||
@pytest.mark.parametrize("calculate_uuid", [True, False]) | ||
def test_return_tuple_with_or_without_uuid(calculate_uuid): | ||
results = awkward.operations.ak_from_parquet.metadata( | ||
Check failure on line 30 in tests/test_3440_calculate_parquet_uuid.py
|
||
input, | ||
{}, | ||
None, | ||
None, | ||
False, | ||
True, | ||
calculate_uuid=calculate_uuid, | ||
) | ||
if calculate_uuid: | ||
assert len(results) == 8, "Expected 8 items in the result tuple" | ||
( | ||
parquet_columns, | ||
subform, | ||
actual_paths, | ||
fs, | ||
subrg, | ||
col_counts, | ||
metadata, | ||
uuid, | ||
) = results | ||
assert uuid is not None, "UUID should be present when calculate_uuid is True" | ||
else: | ||
assert len(results) == 7, "Expected 7 items in the result tuple" | ||
parquet_columns, subform, actual_paths, fs, subrg, col_counts, metadata = ( | ||
results | ||
) |
Uh oh!
There was an error while loading. Please reload this page.