Skip to content

[SPARK-41708][SQL][FOLLOWUP] Do not insert columnar to row transition before write command - #39922

Closed
cloud-fan wants to merge 1 commit into
apache:masterfrom
cloud-fan:write
Closed

[SPARK-41708][SQL][FOLLOWUP] Do not insert columnar to row transition before write command#39922
cloud-fan wants to merge 1 commit into
apache:masterfrom
cloud-fan:write

Conversation

@cloud-fan

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

This is a followup of #39277 . With planned write, the write command requires neither columnar nor row-based execution. It invokes a new API executeWrite, which returns commit messages, not columnar or row-based data.

This PR updates ApplyColumnarRulesAndInsertTransitions to take this case into consideration.

Why are the changes needed?

If people replaces WriteFilesExec with a columnar version, the plan can't be executed due to an extra columnar to row transition between WriteFilesExee and the write command.

Does this PR introduce any user-facing change?

No

How was this patch tested?

new test

assert(result(2).getLong(0) == 301L)

withTempPath { path =>
val e = intercept[Exception](df.write.parquet(path.getCanonicalPath))

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

without the fix, it fails with class org.apache.spark.sql.execution.WholeStageCodegenExec has write support mismatch

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we catch more specific exception though?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Got it. Since it's a test suite and this test case matches the exception message exactly, looks fine.

@cloud-fan

Copy link
Copy Markdown
ContributorAuthor

@ulysses-you

Copy link
Copy Markdown
Contributor

lgtm

@cloud-fan

Copy link
Copy Markdown
ContributorAuthor

thanks for the review, merging to master/3.4!

cloud-fan added a commit that referenced this pull request Feb 7, 2023
… before write command
### What changes were proposed in this pull request?
This is a followup of #39277 . With planned write, the write command requires neither columnar nor row-based execution. It invokes a new API `executeWrite`, which returns commit messages, not columnar or row-based data.
This PR updates `ApplyColumnarRulesAndInsertTransitions` to take this case into consideration.
### Why are the changes needed?
If people replaces `WriteFilesExec` with a columnar version, the plan can't be executed due to an extra columnar to row transition between `WriteFilesExee` and the write command.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
new test
Closes#39922 from cloud-fan/write.
Authored-by: Wenchen Fan <wenchen@databricks.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
(cherry picked from commit 56dd20f)
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
snmvaughan pushed a commit to snmvaughan/spark that referenced this pull request Jun 20, 2023
… before write command
### What changes were proposed in this pull request?
This is a followup of apache#39277 . With planned write, the write command requires neither columnar nor row-based execution. It invokes a new API `executeWrite`, which returns commit messages, not columnar or row-based data.
This PR updates `ApplyColumnarRulesAndInsertTransitions` to take this case into consideration.
### Why are the changes needed?
If people replaces `WriteFilesExec` with a columnar version, the plan can't be executed due to an extra columnar to row transition between `WriteFilesExee` and the write command.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
new test
Closesapache#39922 from cloud-fan/write.
Authored-by: Wenchen Fan <wenchen@databricks.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
(cherry picked from commit 56dd20f)
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@cloud-fan@ulysses-you@HyukjinKwon@dongjoon-hyun