apache / apache/paimon

[Feature] Spark Merge optimization : reading only key columns from target table

Open
#6,669 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
3.4k
Forks
1.4k
Avg merge
1d 11h
Merged PRs (30d)
396

Description

### Search before asking

- [x] I searched in the [issues](https://github.com/apache/paimon/issues) and found nothing similar.

### Motivation

We merge 1 million rows from source into target with 10 million rows:
```
MERGE INTO TableIcebergMOR target
USING TableIcebergMOR_1000000 source
ON target.id = source.id
WHEN MATCHED THEN
UPDATE SET *
WHEN NOT MATCHED
THEN INSERT *
```
In physical plan we see, that target table is full scaned and shuffled :
Image
Same query in Apache Iceberg scans only needed columns, so scan and shuffle **is times faster**:

Image

Is it possible add same optimization in Paimon?
### Solution

_No response_

### Anything else?

_No response_

### Are you willing to submit a PR?

- [ ] I'm willing to submit a PR!

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue names no files, tests, or implementation entry points. Start by reproducing the shown Spark MERGE query and inspecting its physical plan, then trace how Paimon chooses target-table columns and shuffles them. Done means the target scan and shuffle read only columns required by the merge while preserving the query behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spark
Domain
data-engineering, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.