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 {
39
39
val PARQUET_FILTER_PUSHDOWN_ENABLED = " spark.sql.parquet.filterPushdown"
40
40
val PARQUET_USE_DATA_SOURCE_API = " spark.sql.parquet.useDataSourceApi"
41
41
42
+ val HIVE_VERIFY_PARTITIONPATH = " spark.sql.hive.verifyPartitionPath"
43
+
42
44
val COLUMN_NAME_OF_CORRUPT_RECORD = " spark.sql.columnNameOfCorruptRecord"
43
45
val BROADCAST_TIMEOUT = " spark.sql.broadcastTimeout"
44
46
@@ -119,6 +121,10 @@ private[sql] class SQLConf extends Serializable {
119
121
private [spark] def parquetUseDataSourceApi =
120
122
getConf(PARQUET_USE_DATA_SOURCE_API , " true" ).toBoolean
121
123
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
+
122
128
/** When true the planner will use the external sort, which may spill to disk. */
123
129
private [spark] def externalSortEnabled : Boolean = getConf(EXTERNAL_SORT , " false" ).toBoolean
124
130
Original file line number Diff line number Diff line change @@ -147,7 +147,7 @@ class HadoopTableReader(
147
147
def verifyPartitionPath (
148
148
partitionToDeserializer : Map [HivePartition , Class [_ <: Deserializer ]]):
149
149
Map [HivePartition , Class [_ <: Deserializer ]] = {
150
- if (! sc.getConf( " spark.sql.hive. verifyPartitionPath" , " true " ).toBoolean ) {
150
+ if (! sc.conf. verifyPartitionPath) {
151
151
partitionToDeserializer
152
152
} else {
153
153
var existPathSet = collection.mutable.Set [String ]()
@@ -158,9 +158,9 @@ class HadoopTableReader(
158
158
val pathPattern = new Path (pathPatternStr)
159
159
val fs = pathPattern.getFileSystem(sc.hiveconf)
160
160
val matches = fs.globStatus(pathPattern)
161
- matches.map (fileStatus => existPathSet += fileStatus.getPath.toString)
161
+ matches.foreach (fileStatus => existPathSet += fileStatus.getPath.toString)
162
162
}
163
- // convert /demo/data/year/month/day to /demo/data/**/**/* */
163
+ // convert /demo/data/year/month/day to /demo/data/*/*/ */
164
164
def getPathPatternByPath (parNum : Int , tempPath : Path ): String = {
165
165
var path = tempPath
166
166
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 {
61
61
sql(" DROP TABLE table_with_partition" )
62
62
sql(" DROP TABLE createAndInsertTest" )
63
63
}
64
- }
64
+ }
You can’t perform that action at this time.
0 commit comments