vinothchandar commented on a change in pull request #1702:
URL: https://github.com/apache/hudi/pull/1702#discussion_r466667402
##########
File path: hudi-spark/src/main/scala/org/apache/hudi/DefaultSource.scala
##########
@@ -56,29 +58,56 @@ class DefaultSource extends RelationProvider
val parameters = Map(QUERY_TYPE_OPT_KEY -> DEFAULT_QUERY_TYPE_OPT_VAL) ++
translateViewTypesToQueryTypes(optParams)
val path = parameters.get("path")
- if (path.isEmpty) {
- throw new HoodieException("'path' must be specified.")
- }
if (parameters(QUERY_TYPE_OPT_KEY).equals(QUERY_TYPE_SNAPSHOT_OPT_VAL)) {
- // this is just effectively RO view only, where `path` can contain a mix
of
- // non-hoodie/hoodie path files. set the path filter up
- sqlContext.sparkContext.hadoopConfiguration.setClass(
- "mapreduce.input.pathFilter.class",
- classOf[HoodieROTablePathFilter],
- classOf[org.apache.hadoop.fs.PathFilter])
-
- log.info("Constructing hoodie (as parquet) data source with options :" +
parameters)
- log.warn("Snapshot view not supported yet via data source, for
MERGE_ON_READ tables. " +
- "Please query the Hive table registered using Spark SQL.")
- // simply return as a regular parquet relation
- DataSource.apply(
- sparkSession = sqlContext.sparkSession,
- userSpecifiedSchema = Option(schema),
- className = "parquet",
- options = parameters)
- .resolveRelation()
+ val readPathsStr =
parameters.get(DataSourceReadOptions.READ_PATHS_OPT_KEY)
+ if (path.isEmpty && readPathsStr.isEmpty) {
+ throw new HoodieException(s"'path' or '$READ_PATHS_OPT_KEY' or both
must be specified.")
+ }
+
+ val readPaths = readPathsStr.map(p =>
p.split(",").toSeq).getOrElse(Seq())
+ val allPaths = path.map(p => Seq(p)).getOrElse(Seq()) ++ readPaths
+
+ val fs = FSUtils.getFs(allPaths.head,
sqlContext.sparkContext.hadoopConfiguration)
+ val globPaths = HudiSparkUtils.checkAndGlobPathIfNecessary(allPaths, fs)
+
+ val tablePath = DataSourceUtils.getTablePath(fs, globPaths.toArray)
+ log.info("Obtained hudi table path: " + tablePath)
+
+ val metaClient = new HoodieTableMetaClient(fs.getConf, tablePath)
+ val bootstrapIndex = BootstrapIndex.getBootstrapIndex(metaClient)
+
+ val isBootstrappedTable = bootstrapIndex.useIndex()
Review comment:
lets file a follow up on that? I feel the TableFileSystemView can
already provide you that metadata where the file slices dont have an external
base file.
----------------------------------------------------------------
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]