Shekharrajak commented on code in PR #3479:
URL: https://github.com/apache/datafusion-comet/pull/3479#discussion_r2808691698
##########
spark/src/test/scala/org/apache/comet/parquet/CometParquetWriterSuite.scala:
##########
@@ -377,6 +377,167 @@ class CometParquetWriterSuite extends CometTestBase {
}
}
+ private def withNativeWriteConf(f: => Unit): Unit = {
+ withSQLConf(
+ CometConf.COMET_NATIVE_PARQUET_WRITE_ENABLED.key -> "true",
+ CometConf.COMET_EXEC_ENABLED.key -> "true",
+
CometConf.getOperatorAllowIncompatConfigKey(classOf[DataWritingCommandExec]) ->
"true") {
+ f
+ }
+ }
+
+ private def assertCometNativeWrite(insertSql: String): Unit = {
+ val plan = captureSqlWritePlan(insertSql)
+ val hasNativeWrite = plan.exists {
+ case _: CometNativeWriteExec => true
+ case d: DataWritingCommandExec =>
+ d.child.exists(_.isInstanceOf[CometNativeWriteExec])
+ case _ => false
+ }
+ assert(
+ hasNativeWrite,
+ s"Expected CometNativeWriteExec in plan, but not
found:\n${plan.treeString}")
+ }
+
+ private def captureSqlWritePlan(sqlText: String): SparkPlan = {
+ var capturedPlan: Option[QueryExecution] = None
+
+ val listener = new org.apache.spark.sql.util.QueryExecutionListener {
+ override def onSuccess(funcName: String, qe: QueryExecution, durationNs:
Long): Unit = {
+ if (funcName == "command") {
Review Comment:
we can also use :
```
if (qe.executedPlan.exists(_.isInstanceOf[DataWritingCommandExec])) {
capturedPlan = Some(qe)
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]