File tree Expand file tree Collapse file tree 3 files changed +10
-4
lines changed
core/src/main/scala/org/apache/spark/sql
main/scala/org/apache/spark/sql/hive
test/scala/org/apache/spark/sql/hive Expand file tree Collapse file tree 3 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,8 @@ private[spark] object SQLConf {
3939 val PARQUET_FILTER_PUSHDOWN_ENABLED = " spark.sql.parquet.filterPushdown"
4040 val PARQUET_USE_DATA_SOURCE_API = " spark.sql.parquet.useDataSourceApi"
4141
42+ val HIVE_VERIFY_PARTITIONPATH = " spark.sql.hive.verifyPartitionPath"
43+
4244 val COLUMN_NAME_OF_CORRUPT_RECORD = " spark.sql.columnNameOfCorruptRecord"
4345 val BROADCAST_TIMEOUT = " spark.sql.broadcastTimeout"
4446
@@ -119,6 +121,10 @@ private[sql] class SQLConf extends Serializable {
119121 private [spark] def parquetUseDataSourceApi =
120122 getConf(PARQUET_USE_DATA_SOURCE_API , " true" ).toBoolean
121123
124+ /** When true uses verifyPartitionPath to prune the path which is not exists. */
125+ private [spark] def verifyPartitionPath =
126+ getConf(HIVE_VERIFY_PARTITIONPATH , " true" ).toBoolean
127+
122128 /** When true the planner will use the external sort, which may spill to disk. */
123129 private [spark] def externalSortEnabled : Boolean = getConf(EXTERNAL_SORT , " false" ).toBoolean
124130
Original file line number Diff line number Diff line change @@ -147,7 +147,7 @@ class HadoopTableReader(
147147 def verifyPartitionPath (
148148 partitionToDeserializer : Map [HivePartition , Class [_ <: Deserializer ]]):
149149 Map [HivePartition , Class [_ <: Deserializer ]] = {
150- if (! sc.getConf( " spark.sql.hive. verifyPartitionPath" , " true " ).toBoolean ) {
150+ if (! sc.conf. verifyPartitionPath) {
151151 partitionToDeserializer
152152 } else {
153153 var existPathSet = collection.mutable.Set [String ]()
@@ -158,9 +158,9 @@ class HadoopTableReader(
158158 val pathPattern = new Path (pathPatternStr)
159159 val fs = pathPattern.getFileSystem(sc.hiveconf)
160160 val matches = fs.globStatus(pathPattern)
161- matches.map (fileStatus => existPathSet += fileStatus.getPath.toString)
161+ matches.foreach (fileStatus => existPathSet += fileStatus.getPath.toString)
162162 }
163- // convert /demo/data/year/month/day to /demo/data/**/**/* */
163+ // convert /demo/data/year/month/day to /demo/data/*/*/ */
164164 def getPathPatternByPath (parNum : Int , tempPath : Path ): String = {
165165 var path = tempPath
166166 for (i <- (1 to parNum)) path = path.getParent
Original file line number Diff line number Diff line change @@ -61,4 +61,4 @@ class QueryPartitionSuite extends QueryTest {
6161 sql(" DROP TABLE table_with_partition" )
6262 sql(" DROP TABLE createAndInsertTest" )
6363 }
64- }
64+ }
You can’t perform that action at this time.
0 commit comments