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 2019/11/21 03:43:17 UTC
[GitHub] [incubator-hudi] lamber-ken commented on issue #1034: Datasource
Writer throws error on resolving struct fields
lamber-ken commented on issue #1034: Datasource Writer throws error on resolving struct fields
URL: https://github.com/apache/incubator-hudi/issues/1034#issuecomment-556906589
hi, @alphairys, according to your describion, I can not get the error. My steps are bellow.
```
export SPARK_HOME=/work/BigData/install/spark/spark-2.3.3-bin-hadoop2.6
${SPARK_HOME}/bin/spark-shell --packages org.apache.hudi:hudi-spark-bundle:0.5.0-incubating --conf 'spark.serializer=org.apache.spark.serializer.KryoSerializer'
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._
val tableName = "tmp"
val basePath = "file:///tmp/tmp"
var datas = List("{ \"deviceId\": \"aaaaa\", \"eventTimeMilli\": 1574297893836, \"location\": { \"latitude\": 2.5, \"longitude\": 3.5 }}");
val df = spark.read.json(spark.sparkContext.parallelize(datas, 2))
df.write.format("org.apache.hudi").
option(RECORDKEY_FIELD_OPT_KEY, "deviceId").
option(PRECOMBINE_FIELD_OPT_KEY, "eventTimeMilli").
option(TABLE_NAME, tableName).
option(PARTITIONPATH_FIELD_OPT_KEY, "deviceId").
mode(Append).
save(basePath);
```
----------------------------------------------------------------
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
With regards,
Apache Git Services