wForget commented on code in PR #6672:
URL: https://github.com/apache/incubator-gluten/pull/6672#discussion_r1709038600
##########
shims/common/src/main/scala/org/apache/gluten/GlutenConfig.scala:
##########
@@ -1968,6 +1971,13 @@ object GlutenConfig {
.booleanConf
.createWithDefault(false)
+ val VELOX_SCAN_ROOT_PATH_SCHEMA_VALIDATION_ENABLED =
+ buildConf("spark.gluten.sql.scan.root.path.schema.validation.enabled")
Review Comment:
This configuration name is too complicated, can we simplify it?
##########
gluten-core/src/main/scala/org/apache/gluten/execution/FileSourceScanExecTransformer.scala:
##########
@@ -126,6 +127,15 @@ abstract class FileSourceScanExecTransformerBase(
relation.location.inputFiles.toSeq
}
+ override def getRootPathsInternal: Seq[String] = {
+ relation.location match {
+ case c: CatalogFileIndex =>
+ val index = c.filterPartitions(Nil)
Review Comment:
Why not use
`org.apache.spark.sql.execution.datasources.CatalogFileIndex#rootPaths`?
`c.filterPartitions(Nil)` seems to be a dangerous operation, it may list all
hive partitions.
##########
gluten-core/src/main/scala/org/apache/gluten/utils/FileIndexUtil.scala:
##########
@@ -0,0 +1,41 @@
+/*
+ * 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.utils
+
+import org.apache.spark.sql.execution.datasources._
+
+import java.net.URI
+
+object FileIndexUtil {
+ def getRootPath(index: FileIndex): Seq[String] = {
+ index.rootPaths
+ .filter(_.isAbsolute)
+ .map(_.toString)
+ .toSeq
+ }
+
+ def distinctRootPaths(paths: Seq[String]): Seq[String] = {
+ // Skip native validation for local path, as local file system is always
registered.
Review Comment:
I think this logic should not be in the util method, we should put it in the
method that does the validation
--
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]