You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2021/03/12 11:35:10 UTC
[GitHub] [hudi] jonashartwig commented on issue #2661: [SUPPORT] Hive 3 partitions
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:
users@infra.apache.org