lamber-ken edited a comment on issue #1284: [SUPPORT]
URL: https://github.com/apache/incubator-hudi/issues/1284#issuecomment-579204395
 
 
   Hi @haospotai, give you a demo using python with `release-0.5.1` version.
   
   **Step1:**
   ```
   git clone -b release-0.5.1 https://github.com/apache/incubator-hudi.git
   ```
   
   **Step2:**
   ```
   cd incubator-hudi && mvn clean package -DskipTests -DskipITs
   ```
   
   **Step3:**
   ```
   export SPARK_HOME=/work/BigData/install/spark/spark-2.4.4-bin-hadoop2.7
   ${SPARK_HOME}/bin/pyspark \
       --packages org.apache.spark:spark-avro_2.11:2.4.4 \
       --jars `ls 
packaging/hudi-spark-bundle/target/hudi-spark-bundle_*.*-*.*.*-incubating-rc1.jar`
 \
       --conf 'spark.serializer=org.apache.spark.serializer.KryoSerializer'
   
   tableName = "hudi_mor_table"
   basePath = "file:///tmp/hudi_mor_table"
   datas = [{ "name": "kenken", "ts": "qwer", "age": 12, "location": 
"latitude"}]
   
   df = spark.read.json(spark.sparkContext.parallelize(datas, 2))
   df.write.format("org.apache.hudi"). \
       option("hoodie.insert.shuffle.parallelism", "10"). \
       option("hoodie.upsert.shuffle.parallelism", "10"). \
       option("hoodie.delete.shuffle.parallelism", "10"). \
       option("hoodie.bulkinsert.shuffle.parallelism", "10"). \
       option("hoodie.datasource.write.recordkey.field", "name"). \
       option("hoodie.datasource.write.partitionpath.field", "location"). \
       option("hoodie.datasource.write.precombine.field", "ts"). \
       option("hoodie.table.name", tableName). \
       mode("Overwrite"). \
       save(basePath)
   
   spark.read.format("org.apache.hudi").load(basePath + "/*/").show()
   ```

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


With regards,
Apache Git Services

Reply via email to