Skip to content
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

Disallow picking output columns from nested columns. #7248

Merged
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
6 changes: 5 additions & 1 deletion cpp/src/io/parquet/reader_impl.cu
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,11 @@ class aggregate_metadata {
for (const auto &use_name : local_use_names) {
for (size_t schema_idx = 1; schema_idx < pfm.schema.size(); schema_idx++) {
auto const &schema = pfm.schema[schema_idx];
if (use_name == schema.name) { output_column_schemas.push_back(schema_idx); }
// We select only top level columns by name. Selecting nested columns by name is not
// supported. Top level columns are identified by their parent being the root (idx == 0)
if (use_name == schema.name and schema.parent_idx == 0) {
output_column_schemas.push_back(schema_idx);
}
}
}
}
Expand Down
Binary file not shown.
9 changes: 9 additions & 0 deletions python/cudf/cudf/tests/test_parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,15 @@ def test_parquet_reader_mixedcompression(datadir):
assert_eq(expect, got)


def test_parquet_reader_select_columns(datadir):
fname = datadir / "nested_column_map.parquet"

expect = cudf.read_parquet(fname).to_pandas()[["value"]]
got = cudf.read_parquet(fname, columns=["value"])

assert_eq(expect, got)


def test_parquet_reader_invalids(tmpdir):
test_pdf = make_pdf(nrows=1000, nvalids=1000 // 4, dtype=np.int64)

Expand Down