Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
Added parquet struct test
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgecarleitao committed Oct 24, 2021
1 parent 8749215 commit efd4779
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
28 changes: 27 additions & 1 deletion parquet_integration/write_parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,32 @@ def case_nested(size):
)


def case_struct(size):
string = ["Hello", None, "aa", "", None, "abc", None, None, "def", "aaa"]
boolean = [True, None, False, False, None, True, None, None, True, True]
struct_fields = [
("f1", pa.utf8()),
("f2", pa.bool_()),
]
fields = [
pa.field(
"struct",
pa.struct(struct_fields),
)
]
schema = pa.schema(fields)
return (
{
"struct": pa.StructArray.from_arrays(
[pa.array(string * size), pa.array(boolean * size)],
fields=struct_fields,
),
},
schema,
f"struct_nullable_{size*10}.parquet",
)


def write_pyarrow(
case,
size: int,
Expand Down Expand Up @@ -202,7 +228,7 @@ def write_pyarrow(
)


for case in [case_basic_nullable, case_basic_required, case_nested]:
for case in [case_basic_nullable, case_basic_required, case_nested, case_struct]:
for version in [1, 2]:
for use_dict in [True, False]:
write_pyarrow(case, 1, version, use_dict, False, False)
Expand Down
5 changes: 5 additions & 0 deletions tests/it/io/parquet/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,11 @@ fn v2_decimal_26_nullable() -> Result<()> {
fn v2_decimal_26_required() -> Result<()> {
test_pyarrow_integration(8, 2, "basic", false, true)
}

fn v1_struct() -> Result<()> {
test_pyarrow_integration(0, 1, "struct", false, false)
}

/*#[test]
fn v2_nested_nested() {
let _ = test_pyarrow_integration(7, 1, "nested",false, false);
Expand Down

0 comments on commit efd4779

Please sign in to comment.