malinjawi commented on code in PR #12198: URL: https://github.com/apache/gluten/pull/12198#discussion_r3380046676
########## backends-velox/src-delta40/main/scala/org/apache/gluten/extension/PreprocessDeltaScanWithDeletionVectors.scala: ########## @@ -0,0 +1,31 @@ +/* + * 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.spark.sql.SparkSession +import org.apache.spark.sql.catalyst.plans.logical.LogicalPlan +import org.apache.spark.sql.catalyst.rules.Rule + +/** + * Delta 4 prepares DV scan metadata before Gluten offload, so this compatibility rule does not need + * to add backend-visible DV columns. + */ Review Comment: @zhztheplayer Good catch on the shadowing concern. The shadowing `PreprocessTableWithDVs` is necessary because: 1. **Mixed format handling**: Delta's optimizer creates scans with `DeltaParquetFileFormat`, but Gluten's write path produces tables with `GlutenDeltaParquetFileFormat`. The DV preprocessing rule must handle BOTH formats. 2. **Package-private API access**: We need direct access to Delta's package-private APIs (`TahoeFileIndex`, `deletionVectorsReadable()`, `DeltaSQLConf`, etc.) without reflection overhead. Being in `org.apache.spark.sql.delta` package provides this. We could eliminate shadowing by making `GlutenDeltaParquetFileFormat` extend `DeltaParquetFileFormat` instead of `GlutenParquetFileFormat`, then override only write-specific methods. This would let Delta's original `PreprocessTableWithDVs` handle both formats naturally. But the tradoeff would be this breaks the clean format hierarchy separation: - Current: `GlutenParquetFileFormat` → `GlutenDeltaParquetFileFormat` (Gluten hierarchy) - Alternative: `DeltaParquetFileFormat` → `GlutenDeltaParquetFileFormat` (mixed hierarchy) Right now I would say the code maintains format hierarchy separation, avoids reflection for package-private API access, and type-safe handling of both formats in DV preprocessing. But this Requires shadowing Delta's trait (maintenance burden if Delta changes internals) Would you prefer we explore the alternative approach, or is the current shadowing acceptable given the current state? -- 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]
