YannByron commented on a change in pull request #3823:
URL: https://github.com/apache/hudi/pull/3823#discussion_r736729813
##########
File path:
hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/hudi/HoodieSparkSqlWriter.scala
##########
@@ -74,16 +77,23 @@ object HoodieSparkSqlWriter {
: (Boolean, common.util.Option[String], common.util.Option[String],
common.util.Option[String],
SparkRDDWriteClient[HoodieRecordPayload[Nothing]], HoodieTableConfig) = {
+ assert(optParams.get("path").exists(!StringUtils.isNullOrEmpty(_)),
"'path' must be set")
+ val path = optParams("path")
+ val basePath = new Path(path)
val sparkContext = sqlContext.sparkContext
- val path = parameters.get("path")
- val hoodieConfig = HoodieWriterUtils.convertMapToHoodieConfig(parameters)
- val tblNameOp = hoodieConfig.getStringOrThrow(HoodieWriteConfig.TBL_NAME,
s"'${HoodieWriteConfig.TBL_NAME.key}' must be set.")
+ val fs = basePath.getFileSystem(sparkContext.hadoopConfiguration)
+ tableExists = fs.exists(new Path(basePath,
HoodieTableMetaClient.METAFOLDER_NAME))
+ var tableConfig = getHoodieTableConfig(sparkContext, path,
hoodieTableConfigOpt)
+ validateTableConfig(sqlContext.sparkSession, optParams, tableConfig)
+
+ val parameters =
DataSourceWriteOptions.translateSqlOptions(HoodieWriterUtils.parametersWithWriteDefaults(optParams))
+ val hoodieConfig = mergeAndGetHoodieConfig(parameters, tableConfig)
+
assert(!StringUtils.isNullOrEmpty(hoodieConfig.getString(HoodieWriteConfig.TBL_NAME)),
Review comment:
agree.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]