[GLUTEN-6705] [CORE] [Part 1] Avoid adding c2r for ColumnarWriteFilesExec, since it neither output Columnar batch data nor InternalRow#6745
Merged
baibaichen merged 1 commit intoapache:mainfrom Aug 8, 2024
Conversation
|
Run Gluten Clickhouse CI |
Member
Contributor
zhztheplayer
reviewed
Aug 8, 2024
Member
zhztheplayer
left a comment
There was a problem hiding this comment.
Just some minors. Thanks.
Comment on lines
+95
to
+100
| case _: ColumnarWriteFilesExec.ExecuteWriteCompatible => | ||
| // ColumnarWriteFilesExec neither output Row nor columnar data. | ||
| // We output both row and columnar to avoid c2r and r2c transitions. | ||
| Convention.of( | ||
| Convention.RowType.VanillaRow, | ||
| BackendsApiManager.getSparkPlanExecApiInstance.batchType) |
Member
There was a problem hiding this comment.
Basically this list is for overriding conventions of vanilla Spark's operators. Would you use interface KnowBatchType / KnownRowType instead?
Comment on lines
+161
to
+164
| case _: ColumnarWriteFilesExec.ExecuteWriteCompatible => | ||
| ConventionReq.of( | ||
| ConventionReq.RowType.Any, | ||
| ConventionReq.BatchType.Is(BackendsApiManager.getSparkPlanExecApiInstance.batchType)) |
Member
There was a problem hiding this comment.
The same. Use interface KnownChildrenConventions instead.
| ConventionReq.of(ConventionReq.RowType.Any, ConventionReq.BatchType.Is(toBatchType))) | ||
| } | ||
|
|
||
| private def convert(plan: SparkPlan, req: ConventionReq): SparkPlan = { |
Member
There was a problem hiding this comment.
I'd suggest to rename convert which sounds too general. How about enforceReq?
Avoid adding c2r for ColumnarWriteFilesExec, since it neither output Columnar batch data nor InternalRow
5930d83 to
7bffb86
Compare
|
Run Gluten Clickhouse CI |
zhztheplayer
approved these changes
Aug 8, 2024
2 tasks
zhztheplayer
added a commit
to zhztheplayer/gluten
that referenced
this pull request
Aug 12, 2024
zhztheplayer
added a commit
that referenced
this pull request
Aug 13, 2024
sharkdtu
pushed a commit
to sharkdtu/gluten
that referenced
this pull request
Nov 11, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
This PR avoids c2r and r2c transition by returning
Conventionwhich ouputs bothVanillaRowandBatchTypeforColumnarWriteFilesExec.Why need
ColumnarWriteFilesExecneither outputs Columnar batch data norInternalRow, and hence we can't add c2r or r2c on top of it, otherwise it would be am internal error.DataWritingCommandExecis on top ofColumnarWriteFilesExecandDataWritingCommandExec's Convention isVanillaRowwhich avoid c2r transition.WriteFileis directly added on top of delta logical plan and hence the rootSparkPlanisColumnarWriteFilesExecwhich casue internal error without this change.Other refactor
org.apache.spark.sql.catalyst.util.sideBySideto ouptput changed plan, which is same as sparkRuleExecutor.case _ if !plan.supportsColumnar=>case _ if plan.supportsColumnarCHBatch.fromRow(Fixes: #6705)
How was this patch tested?
Existed UTs