wombatu-kun commented on code in PR #12772:
URL: https://github.com/apache/hudi/pull/12772#discussion_r2099966398


##########
hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/spark/sql/hudi/command/CreateHoodieTableAsSelectCommand.scala:
##########
@@ -100,7 +101,8 @@ case class CreateHoodieTableAsSelectCommand(
         HiveSyncConfigHolder.HIVE_TABLE_PROPERTIES.key -> 
ConfigUtils.configToString(updatedTable.properties.asJava),
         HoodieWriteConfig.COMBINE_BEFORE_INSERT.key -> "false",
         DataSourceWriteOptions.SQL_INSERT_MODE.key -> 
InsertMode.NON_STRICT.value(),
-        DataSourceWriteOptions.SQL_ENABLE_BULK_INSERT.key -> "true"
+        DataSourceWriteOptions.SQL_ENABLE_BULK_INSERT.key -> "true",
+        "path" -> tablePath

Review Comment:
   Without "path" in options we have error in test (with old versions of Spark 
too):
   TestCOWDataSource.testSaveAsTableInDifferentModes:1578:
   ```
   java.lang.IllegalArgumentException: 'path' or 'glob paths' option required
        at 
org.apache.hudi.HoodieFileIndex$.$anonfun$getQueryPaths$1(HoodieFileIndex.scala:600)
        at 
scala.collection.immutable.HashMap$HashTrieMap.getOrElse0(HashMap.scala:596)
        at 
scala.collection.immutable.HashMap$HashTrieMap.getOrElse0(HashMap.scala:594)
        at scala.collection.immutable.HashMap.getOrElse(HashMap.scala:73)
        at 
org.apache.hudi.HoodieFileIndex$.org$apache$hudi$HoodieFileIndex$$getQueryPaths(HoodieFileIndex.scala:600)
        at org.apache.hudi.HoodieFileIndex.<init>(HoodieFileIndex.scala:100)
        at 
org.apache.spark.sql.hudi.ProvidesHoodieConfig.deduceOverwriteConfig(ProvidesHoodieConfig.scala:367)
        at 
org.apache.spark.sql.hudi.ProvidesHoodieConfig.deduceOverwriteConfig$(ProvidesHoodieConfig.scala:339)
        at 
org.apache.spark.sql.hudi.command.InsertIntoHoodieTableCommand$.deduceOverwriteConfig(InsertIntoHoodieTableCommand.scala:80)
        at 
org.apache.spark.sql.hudi.command.InsertIntoHoodieTableCommand$.run(InsertIntoHoodieTableCommand.scala:107)
        at 
org.apache.spark.sql.hudi.command.CreateHoodieTableAsSelectCommand.run(CreateHoodieTableAsSelectCommand.scala:113)
   ...
   ```
   HoodieFileIndex.getQueryPaths(options) throws exception:
   ```
     private def getQueryPaths(options: Map[String, String]): Seq[StoragePath] 
= {
       // NOTE: To make sure that globbing is appropriately handled w/in the
       //       `path`, we need to:
       //          - First, probe whether requested globbed paths has been 
resolved (and `glob.paths` was provided
       //          in options); otherwise
       //          - Treat `path` as fully-qualified (ie non-globbed) path
       val paths = options.get("glob.paths") match {
         case Some(globbed) =>
           globbed.split(",").toSeq
         case None =>
           val path = options.getOrElse("path",
             throw new IllegalArgumentException("'path' or 'glob paths' option 
required"))
           Seq(path)
       }
   
       paths.map(new StoragePath(_))
     }
   ```
   



-- 
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]

Reply via email to