You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "boneanxs (via GitHub)" <gi...@apache.org> on 2023/08/21 03:47:54 UTC
[GitHub] [hudi] boneanxs commented on a diff in pull request #9484: [HUDI-6729] Fix get partition values from path for non-string type partition column
boneanxs commented on code in PR #9484:
URL: https://github.com/apache/hudi/pull/9484#discussion_r1299568608
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieBaseRelation.scala:
##########
@@ -483,24 +483,20 @@ abstract class HoodieBaseRelation(val sqlContext: SQLContext,
protected def getPartitionColumnsAsInternalRowInternal(file: FileStatus, basePath: Path,
extractPartitionValuesFromPartitionPath: Boolean): InternalRow = {
try {
- val tableConfig = metaClient.getTableConfig
if (extractPartitionValuesFromPartitionPath) {
val tablePathWithoutScheme = CachingPath.getPathWithoutSchemeAndAuthority(basePath)
val partitionPathWithoutScheme = CachingPath.getPathWithoutSchemeAndAuthority(file.getPath.getParent)
val relativePath = new URI(tablePathWithoutScheme.toString).relativize(new URI(partitionPathWithoutScheme.toString)).toString
- val hiveStylePartitioningEnabled = tableConfig.getHiveStylePartitioningEnable.toBoolean
- if (hiveStylePartitioningEnabled) {
- val partitionSpec = PartitioningUtils.parsePathFragment(relativePath)
- InternalRow.fromSeq(partitionColumns.map(partitionSpec(_)).map(UTF8String.fromString))
- } else {
- if (partitionColumns.length == 1) {
- InternalRow.fromSeq(Seq(UTF8String.fromString(relativePath)))
- } else {
- val parts = relativePath.split("/")
- assert(parts.size == partitionColumns.length)
- InternalRow.fromSeq(parts.map(UTF8String.fromString))
- }
- }
+ val timeZoneId = conf.get("timeZone", sparkSession.sessionState.conf.sessionLocalTimeZone)
+ val rowValues = HoodieSparkUtils.parsePartitionColumnValues(
Review Comment:
`HoodieSparkUtils.parsePartitionColumnValues` could return empty if it can't parse partition values, we better add an assertion here to ensure the values' size is equal to the number of partition columns.
--
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: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org