Shekharrajak commented on code in PR #3479:
URL: https://github.com/apache/datafusion-comet/pull/3479#discussion_r2808696688
##########
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") {
+ capturedPlan = Some(qe)
+ }
+ }
+ override def onFailure(
+ funcName: String,
+ qe: QueryExecution,
+ exception: Exception): Unit = {}
+ }
+
+ spark.listenerManager.register(listener)
+ try {
+ sql(sqlText)
+ val maxWaitTimeMs = 5000
+ val checkIntervalMs = 50
+ var iterations = 0
+ while (capturedPlan.isEmpty && iterations < maxWaitTimeMs /
checkIntervalMs) {
Review Comment:
wait for sometime to make sure query plan is completed.
--
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]