Skip to content

fix(spark) CTAS with UNION in Spark 4.x native writer#3524

Open
Shekharrajak wants to merge 1 commit intoapache:mainfrom
Shekharrajak:fix/3429-spark4-ctas-union-native-writer
Open

fix(spark) CTAS with UNION in Spark 4.x native writer#3524
Shekharrajak wants to merge 1 commit intoapache:mainfrom
Shekharrajak:fix/3429-spark4-ctas-union-native-writer

Conversation

@Shekharrajak
Copy link
Contributor

Which issue does this PR close?

Closes #3429

Rationale for this change

CTAS with UNION fails in Spark 4.x when the Comet native writer is enabled. The requiresNativeChildren check in CometExecRule was too strict - it required children to be CometNativeExec, but sink operators like CometUnionExec, CometCoalesceExec, CometCollectLimitExec extend CometExec directly while still producing Arrow-formatted data.

What changes are included in this PR?

  • Changed the type check from CometNativeExec to CometExec in CometExecRule.convertToComet() to allow all Comet operators that produce Arrow-formatted data as input to the native writer.

How are these changes tested?

Added 6 new test cases in CometParquetWriterSuite:

  • Basic UNION write (CTAS style)
  • Multiple (3+) DataFrames UNION

@Shekharrajak Shekharrajak changed the title Fix CTAS with UNION in Spark 4.x native writer (#3429) Fix CTAS with UNION in Spark 4.x native writer Feb 16, 2026
@Shekharrajak Shekharrajak changed the title Fix CTAS with UNION in Spark 4.x native writer fix(spark) CTAS with UNION in Spark 4.x native writer Feb 16, 2026
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.

[COMET NATIVE WRITER] Fix test spark 4x : ctas with union

1 participant

Comments