CometIcebergNativeScanExec: propagate outputOrdering from originalPlan instead of hardcoding Nil

Open Beginner friendly
#4,367 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Quiet
Tech stack
scala
Domain
performance

Research direction

Start in CometIcebergNativeScanExec.scala and inspect how originalPlan wraps the Iceberg BatchScanExec. Verify how BatchScanExec.outputOrdering is exposed, then update the scan's ordering behavior so it preserves that value when originalPlan exists and remains Nil otherwise. Done means native Iceberg scans can report the original ordering without an unnecessary CometSortExec.

Written by the indexing model from the issue text.

Description

area:scan enhancement priority:medium
What is the problem the feature request solves?

CometIcebergNativeScanExec.scala hardcodes outputOrdering to Nil:

override lazy val outputOrdering: Seq[SortOrder] = Nil

Ref https://github.com/apache/iceberg/issues/16430

We can update it to :

override lazy val outputOrdering: Seq[SortOrder] =
  if (originalPlan != null) originalPlan.outputOrdering else Nil

originalPlan is the wrapped BatchScanExec. Once Iceberg implements SupportsReportOrdering, BatchScanExec.outputOrdering returns the correct sort order and Comet inherits it

This wil eliminate CometSortExec above Iceberg native scans for sort-merge joins .

Describe the potential solution

No response

Additional context

No response

Dominant language
Scala
Stars
1.3k
Forks
377
Avg merge
2d 13h
Merged PRs (30d)
244

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/datafusion-comet

All issues in apache/datafusion-comet

Similar issues

More Scala issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.