jonashartwig commented on issue #2661:
URL: https://github.com/apache/hudi/issues/2661#issuecomment-797434562


   I checked the config section again. There is a property to set to create 
proper hive partitions. Here is the fixed code:
   
   ```scala
   import org.apache.spark.sql.Row
   val rdd = spark.sparkContext.parallelize(List(Row(1, "a")))
   import org.apache.spark.sql.types._
   val df = spark.createDataFrame(rdd, StructType(List(StructField("int", 
IntegerType), StructField("string", StringType))))
   
   import org.apache.hudi.QuickstartUtils._
   import scala.collection.JavaConversions._
   import org.apache.spark.sql.SaveMode._
   import org.apache.hudi.DataSourceReadOptions._
   import org.apache.hudi.DataSourceWriteOptions._
   import org.apache.hudi.config.HoodieWriteConfig._
   
df.write.format("hudi").partitionBy("int").mode(Overwrite).option(HIVE_STYLE_PARTITIONING_OPT_KEY,
 "true").option(TABLE_NAME, "hudi").option(PRECOMBINE_FIELD_OPT_KEY, 
"int").option(RECORDKEY_FIELD_OPT_KEY, 
"int").option(PARTITIONPATH_FIELD_OPT_KEY, 
"int").save("/data/test/swe/base/hudi/hudi")
   ```


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


Reply via email to