Skip to content

ListingTable reads that project partition columns fail on deserialization #17920

@mach-kernel

Description

@mach-kernel

Describe the bug

When querying a Hive partitioned table, trying to project any of the partition columns after ser/de fails on deserialize. This query, using the test dataset partitioned_table_json fails over Ballista:

select id, part from partitioned_table_json

To Reproduce

amazon_reviews is a table Hive partitioned on (marketplace, review_date):

explain select marketplace, review_date, count(*) from amazon_reviews group by marketplace, review_date;

Produces plan:
https://gist.githubusercontent.com/mach-kernel/a20d00c8e6595cfc4332476bb857e251/raw/0a5c630ab883a6d092c3b9a21bc13d7ae99ca2d7/agg_plan.json

On deserialize, column lookup fails here because TableScan schema does not include partition colums:

let mut projection = None;
if let Some(columns) = &scan.projection {
let column_indices = columns
.columns
.iter()
.map(|name| schema.index_of(name))
.collect::<Result<Vec<usize>, _>>()?;
projection = Some(column_indices);
}

Related:

#15718
#15737

Expected behavior

The plan deserializes without error

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions