felipepessoto commented on code in PR #13667:
URL: https://github.com/apache/gluten/pull/13667#discussion_r4662754456


##########
gluten-substrait/src/main/scala/org/apache/gluten/execution/FileSourceScanExecTransformer.scala:
##########
@@ -183,6 +183,12 @@ abstract class FileSourceScanExecTransformerBase(
   }
 
   override protected def doValidateInternal(): ValidationResult = {

Review Comment:
   The V2 path is reachable; it now checks `FileScan.readDataSchema` with the 
same helper as V1's `requiredSchema`. Added explicit V1/V2 plan tests for 
selected defaults, filter-only references, pruning, count(*), and NULL defaults.
   
   I also checked the in-tree subclasses: Delta and Hudi both call 
`super.doValidateInternal()`, and the custom-scan test subclass inherits 
validation. There isn't a production V1 override bypassing the guard. Other V2 
connectors keep their provider-specific behavior; this new V2 check is scoped 
to Spark `FileScan`.
   
   The shared helper uses `ResolveDefaultColumns.getExistenceDefaultValues`, 
which is available from Spark 3.4 onward, so the version-specific shim 
additions are no longer needed. Focused runs passed on Spark 3.4, 3.5, and 4.1.



##########
gluten-ut/common/src/test/scala/org/apache/spark/sql/GlutenDefaultColumnScanTests.scala:
##########
@@ -0,0 +1,102 @@
+/*
+ * 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.spark.sql
+
+import org.apache.gluten.config.GlutenConfig
+import org.apache.gluten.execution.FileSourceScanExecTransformerBase
+
+import org.apache.spark.sql.execution.FileSourceScanExec
+import org.apache.spark.sql.internal.SQLConf
+
+trait GlutenDefaultColumnScanTests extends GlutenSQLTestsBaseTrait {

Review Comment:
   Done in 805eec4be. Removed the shared trait and restored all five 
`GlutenFileScanSuite` wrappers. The plan assertions now live in 
`VeloxScanSuite`, with one case for V1 and one for V2. They check read/filter 
fallback, affected-column diagnostics, and native pruning/count/NULL-default 
controls. Read-correctness coverage comes from the restored Spark originals; 
the Delta conversion regression remains in `VeloxDeltaSuite`.



##########
gluten-ut/spark35/src/test/scala/org/apache/spark/sql/sources/GlutenInsertSuite.scala:
##########
@@ -422,9 +422,9 @@ class GlutenInsertSuite
             sql("insert into t select false")
           }
           sql("alter table t add column s array<int> default array(1, 2)")
-          checkAnswer(spark.table("t"), Row(false, null))
+          checkAnswer(spark.table("t"), Row(false, Seq(1, 2)))

Review Comment:
   Agreed. Removed all four duplicated default-column test blocks from each 
Spark-version `GlutenInsertSuite` and restored the original Spark tests by 
removing their exclusions. Also removed the matching Bolt 3.x exclusions so 
deleting the copies doesn't lose that coverage. No assertions in the original 
Spark tests were changed.
   
   All four originals passed locally on Spark 3.4, 3.5, and 4.1 with Velox, 
including the previously ignored map-default case. The V1/V2 plan tests passed 
on those versions too, and the Delta conversion regression passed on 4.1. 
ClickHouse/Bolt runtime validation remains for CI.



##########
gluten-substrait/src/main/scala/org/apache/gluten/execution/FileSourceScanExecTransformer.scala:
##########
@@ -183,6 +183,12 @@ abstract class FileSourceScanExecTransformerBase(
   }
 
   override protected def doValidateInternal(): ValidationResult = {
+    if (hasNonNullExistenceDefaults) {
+      // Missing fields need their original default, while explicitly stored 
nulls must stay null.
+      return ValidationResult.failed(
+        "Native file scans do not support non-null existence defaults 
(EXISTS_DEFAULT).")

Review Comment:
   Added in 805eec4be. The reason now lists just the required columns whose 
evaluated existence defaults are non-null, for example `on columns: value, s.` 
Both the V1 and V2 plan tests check the names, including excluding a selected 
column with a typed NULL default.



-- 
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]

Reply via email to