Skip to content

Conversation

mach-kernel
Copy link

@mach-kernel mach-kernel commented Oct 4, 2025

Which issue does this PR close?

TBD

Rationale for this change

Since table partition columns are serialized separately for ListingScan, apache#15737 made a change to remove them from the TableScan schema so they would not be duplicated. Unfortunately, queries with projections that reference the partition columns would fail to resolve here:

https://github.com/apache/datafusion/blob/daeb6597a0c7344735460bb2dce13879fd89d7bd/datafusion/proto/src/logical_plan/mod.rs#L382-L390

The round-trip test used a partition column in its SELECT to exercise this, however the unoptimized plan did not have projections decorated (so they would not get serialized, and there would be no lookup to fail). As in, scan.projection above would be None.

What changes are included in this PR?

  • Do the projection name -> index binding using ListingTable::schema, at which point the partition columns are decorated
  • Since we're testing the round-tripping of the plan, make a plan with LogicalPlanBuilder that explicitly specifies a projection to ensure we're testing this functionality
    • This test fails on main

Upstream apache#17911

Copy link

@kczimm kczimm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mach-kernel mach-kernel merged commit 7270277 into spiceai-49 Oct 6, 2025
@mach-kernel mach-kernel deleted the mach/listing-scan-projection branch October 6, 2025 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants