-
Notifications
You must be signed in to change notification settings - Fork 28k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-19833][SQL]remove SQLConf.HIVE_VERIFY_PARTITION_PATH, always return empty when the location does not exists #17176
Closed
Closed
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
95aa931
[SPARK-19833][SQL]remove SQLConf.HIVE_VERIFY_PARTITION_PATH, always r…
windpiger 8128567
fix a bug
windpiger 22b1f53
add log to find why jenkins failed
windpiger 5fd0e20
Merge branch 'master' of github.com:apache/spark into removeHiveVerfi…
windpiger 262e2f2
fix test failed
windpiger 3a15e5d
remove log
windpiger File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -159,36 +159,11 @@ class HadoopTableReader( | |
def verifyPartitionPath( | ||
partitionToDeserializer: Map[HivePartition, Class[_ <: Deserializer]]): | ||
Map[HivePartition, Class[_ <: Deserializer]] = { | ||
if (!sparkSession.sessionState.conf.verifyPartitionPath) { | ||
partitionToDeserializer | ||
} else { | ||
var existPathSet = collection.mutable.Set[String]() | ||
var pathPatternSet = collection.mutable.Set[String]() | ||
partitionToDeserializer.filter { | ||
case (partition, partDeserializer) => | ||
def updateExistPathSetByPathPattern(pathPatternStr: String) { | ||
val pathPattern = new Path(pathPatternStr) | ||
val fs = pathPattern.getFileSystem(hadoopConf) | ||
val matches = fs.globStatus(pathPattern) | ||
matches.foreach(fileStatus => existPathSet += fileStatus.getPath.toString) | ||
} | ||
// convert /demo/data/year/month/day to /demo/data/*/*/*/ | ||
def getPathPatternByPath(parNum: Int, tempPath: Path): String = { | ||
var path = tempPath | ||
for (i <- (1 to parNum)) path = path.getParent | ||
val tails = (1 to parNum).map(_ => "*").mkString("/", "/", "/") | ||
path.toString + tails | ||
} | ||
|
||
val partPath = partition.getDataLocation | ||
val partNum = Utilities.getPartitionDesc(partition).getPartSpec.size(); | ||
var pathPatternStr = getPathPatternByPath(partNum, partPath) | ||
if (!pathPatternSet.contains(pathPatternStr)) { | ||
pathPatternSet += pathPatternStr | ||
updateExistPathSetByPathPattern(pathPatternStr) | ||
} | ||
existPathSet.contains(partPath.toString) | ||
} | ||
partitionToDeserializer.filter { | ||
case (partition, partDeserializer) => | ||
val partPath = partition.getDataLocation | ||
val fs = partPath.getFileSystem(hadoopConf) | ||
fs.exists(partPath) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Each partition sending an RPC request to the NameNode can result in poor performance |
||
} | ||
} | ||
|
||
|
@@ -197,6 +172,11 @@ class HadoopTableReader( | |
val partDesc = Utilities.getPartitionDesc(partition) | ||
val partPath = partition.getDataLocation | ||
val inputPathStr = applyFilterIfNeeded(partPath, filterOpt) | ||
|
||
// scalastyle:off println | ||
println(s"=1==${inputPathStr}, ${partPath.toString}, " + | ||
s"${if (filterOpt.isDefined) filterOpt.get.toString}===") | ||
|
||
val ifc = partDesc.getInputFileFormatClass | ||
.asInstanceOf[java.lang.Class[InputFormat[Writable, Writable]]] | ||
// Get partition field info | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after this pr https://github.com/apache/spark/pull/17187, read hive table which does not use
stored by
will not useHiveTableScanExec
.this function has a bug ,that if the partition path is custom path
partitionToDeserializer
,/root/a
and the partitionSpec is
b=1/c=2
, this will lead to scan/
because of thegetPathPatternByPath