teeyog commented on a change in pull request #2475:
URL: https://github.com/apache/hudi/pull/2475#discussion_r579910252
##########
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:
I will try to see if I can automatically infer this but also meet your
needs
----------------------------------------------------------------
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]