teeyog commented on a change in pull request #2475:
URL: https://github.com/apache/hudi/pull/2475#discussion_r580728819
##########
File path:
hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/hudi/DefaultSource.scala
##########
@@ -74,6 +78,19 @@ class DefaultSource extends RelationProvider
val tablePath = DataSourceUtils.getTablePath(fs, globPaths.toArray)
log.info("Obtained hudi table path: " + tablePath)
+ val sparkEngineContext = new
HoodieSparkEngineContext(sqlContext.sparkContext)
+ val fsBackedTableMetadata =
+ new FileSystemBackedTableMetadata(sparkEngineContext, new
SerializableConfiguration(fs.getConf), tablePath, false)
+ val partitionPaths = fsBackedTableMetadata.getAllPartitionPaths
+ val onePartitionPath = if(!partitionPaths.isEmpty &&
!StringUtils.isEmpty(partitionPaths.get(0))) {
+ tablePath + "/" + partitionPaths.get(0)
+ } else {
+ tablePath
+ }
+ val dataPath = DataSourceUtils.getDataPath(tablePath, onePartitionPath)
+ log.info("Obtained hudi data path: " + dataPath)
+ parameters += "path" -> dataPath
Review comment:
@vinothchandar Now it supports your needs. If the path specified by the
user is a table path, it will be automatically inferred, otherwise it will not
be inferred.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]