Skip to content

Commit 0342137

Browse files
committed
fix: clear explain info tags before fallback in auto scan mode
When nativeDataFusionScan fails and adds explain info tags to the scanExec node, those tags leak into the nativeIcebergCompatScan fallback path. Clear tags with unsetTagValue before attempting the fallback to prevent contamination.
1 parent 738694a commit 0342137

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

spark/src/main/scala/org/apache/comet/rules/CometScanRule.scala

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import org.apache.spark.sql.execution.datasources.v2.csv.CSVScan
4141
import org.apache.spark.sql.internal.SQLConf
4242
import org.apache.spark.sql.types._
4343

44-
import org.apache.comet.{CometConf, CometNativeException, DataTypeSupport}
44+
import org.apache.comet.{CometConf, CometExplainInfo, CometNativeException, DataTypeSupport}
4545
import org.apache.comet.CometConf._
4646
import org.apache.comet.CometSparkSessionExtensions.{isCometLoaded, withInfo, withInfos}
4747
import org.apache.comet.DataTypeSupport.isComplexType
@@ -169,7 +169,12 @@ case class CometScanRule(session: SparkSession)
169169
COMET_NATIVE_SCAN_IMPL.get() match {
170170
case SCAN_AUTO =>
171171
nativeDataFusionScan(plan, session, scanExec, r, hadoopConf)
172-
.orElse(nativeIcebergCompatScan(session, scanExec, r, hadoopConf))
172+
.orElse {
173+
// Clear explain info tags from the failed nativeDataFusionScan
174+
// attempt so they don't leak into the fallback path
175+
scanExec.unsetTagValue(CometExplainInfo.EXTENSION_INFO)
176+
nativeIcebergCompatScan(session, scanExec, r, hadoopConf)
177+
}
173178
.getOrElse(scanExec)
174179
case SCAN_NATIVE_DATAFUSION =>
175180
nativeDataFusionScan(plan, session, scanExec, r, hadoopConf).getOrElse(scanExec)

0 commit comments

Comments
 (0)