You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gluten.apache.org by "Weixin-Xu (via GitHub)" <gi...@apache.org> on 2026/10/20 06:49:03 UTC

[PR] [BOLT] Correct table scan and Delta Paimon integration [gluten]

Weixin-Xu opened a new pull request, #13379:
URL: https://github.com/apache/gluten/pull/13379

     ## What changes are proposed in this pull request?
   
     This PR fixes scan metadata handling and table-format integration in the Bolt backend.
   
     - Preserve Substrait row-index column types and exclude partition columns from the physical file schema, while retaining scan outputs and column assignments.
     - Register Delta change data feed expansion during optimization, controlled by a Bolt-specific session setting.
     - Fall back to Spark when a Delta scan reads files with actual deletion vectors. Keep DV-free scans eligible for native execution, including scans whose partition filters exclude files containing deletion
     vectors.
     - Honor `spark.gluten.paimon.native.source.enabled` when the Bolt Paimon offload rule executes, preserving native offload by default.
     - Add the missing Bolt TPC-H suite base and correct classpath resource references in the Delta and Hudi suites, following the existing Velox default test behavior.
   
     Add focused regressions for scan metadata, Delta CDF configuration, deletion-vector fallback, and Paimon source configuration.
   
     Changes are scoped to Bolt implementation and tests.
   
     ## How was this patch tested?
   
     These changes were validated as part of the integrated Bolt CI candidate using Bolt revision `071e54764f887dfb4337260e440f2f12f6ab82f5` with the recorded engine fixes applied.
   
     Regression coverage includes:
   
     - Row-index column mapping, invalid column-count rejection, and partition-column exclusion from the physical file schema.
     - Delta CDF optimizer registration, output identity, and session configuration changes.
     - A Delta DELETE that creates an actual deletion vector, followed by exact result checks and verification of Spark fallback. DV-free and partition-pruned scans remain native.
     - Paimon source configuration defaults, explicit disabling, and changes across SQLConf contexts.
   
     Integrated validation included the affected complete Spark reference cases and an additional Spark 4.1 Delta reactor run covering four DELETE suites.
   
     After rebasing this topic onto Apache Gluten main, patch-equivalence checks passed. All 13 changed files retained their original contents and modes, and `git diff --check` passed.
   
     The standalone rebased branch has not been rebuilt or runtime-tested independently. Native Delta deletion-vector reading remains unsupported; this PR preserves correctness through Spark fallback.
   
     ## Was this patch authored or co-authored using generative AI tooling?
   
     Generated-by: Codex (GPT-6)


-- 
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: commits-unsubscribe@gluten.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org


Re: [PR] [BOLT] Correct table scan and Delta Paimon integration [gluten]

Posted by "liuneng1994 (via GitHub)" <gi...@apache.org>.
liuneng1994 commented on code in PR #13379:
URL: https://github.com/apache/gluten/pull/13379#discussion_r4345085014


##########
backends-bolt/src-delta/main/scala/org/apache/gluten/extension/BoltOffloadDeltaScan.scala:
##########
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.gluten.extension
+
+import org.apache.gluten.extension.columnar.FallbackTags
+import org.apache.gluten.extension.columnar.offload.OffloadSingleNode
+
+import org.apache.spark.sql.delta.files.{TahoeBatchFileIndex, TahoeFileIndex, TahoeRemoveFileIndex}
+import org.apache.spark.sql.delta.stats.PreparedDeltaFileIndex
+import org.apache.spark.sql.execution.{FileSourceScanExec, SparkPlan}
+
+/** Keeps actual Delta deletion-vector reads on Spark until Bolt supports the DV split protocol. */
+case class BoltOffloadDeltaScan() extends OffloadSingleNode {
+  private val delegate = OffloadDeltaScan(enableNativeDmlRowIndexScan = true)

Review Comment:
   `enableNativeDmlRowIndexScan` is hardcoded to `true`, while Velox derives it from `new VeloxDeltaConfig(c.sqlConf).enableNativeDmlRowIndexScan` (`VeloxDeltaComponent.scala:56-58`). Since this delegate is only reached for DV-free scans, `true` may be fine, but please state the rationale (or add a Bolt config) so the divergence is intentional.



##########
backends-bolt/src-delta/main/scala/org/apache/gluten/extension/BoltOffloadDeltaScan.scala:
##########
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.gluten.extension
+
+import org.apache.gluten.extension.columnar.FallbackTags
+import org.apache.gluten.extension.columnar.offload.OffloadSingleNode
+
+import org.apache.spark.sql.delta.files.{TahoeBatchFileIndex, TahoeFileIndex, TahoeRemoveFileIndex}
+import org.apache.spark.sql.delta.stats.PreparedDeltaFileIndex
+import org.apache.spark.sql.execution.{FileSourceScanExec, SparkPlan}
+
+/** Keeps actual Delta deletion-vector reads on Spark until Bolt supports the DV split protocol. */
+case class BoltOffloadDeltaScan() extends OffloadSingleNode {
+  private val delegate = OffloadDeltaScan(enableNativeDmlRowIndexScan = true)
+
+  override def offload(plan: SparkPlan): SparkPlan = plan match {
+    case scan: FileSourceScanExec if readsDeletionVector(scan) =>
+      FallbackTags.add(scan, "Bolt does not support native Delta deletion-vector reads")
+      scan
+    case other => delegate.offload(other)
+  }
+
+  private def readsDeletionVector(scan: FileSourceScanExec): Boolean = {
+    scan.relation.location match {
+      case index: TahoeRemoveFileIndex =>
+        index.filesByVersion.exists(_.actions.exists(_.deletionVector != null))
+      case index: PreparedDeltaFileIndex =>
+        index.preparedScan.files.exists(_.deletionVector != null)
+      case index: TahoeBatchFileIndex =>
+        index.addFiles.exists(_.deletionVector != null)
+      case index: TahoeFileIndex =>
+        index.matchingFiles(scan.partitionFilters, scan.dataFilters)

Review Comment:
   `matchingFiles(...)` enumerates the Delta log on the driver for every `FileSourceScanExec` during offload. On large tables this duplicates the listing Spark will do later and can be a noticeable planning-time cost. Could this reuse the scan's already-resolved files, or be cached per `TahoeFileIndex`? Please also confirm `matchingFiles` is safe for every `TahoeFileIndex` subclass that can reach this branch.



-- 
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: commits-unsubscribe@gluten.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org