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 2020/12/18 10:56:15 UTC
[GitHub] [hudi] AnweshaSen opened a new issue #2347: [SUPPORT] UPSERT ON A DATAFRAME LOADED WITH A CSV
AnweshaSen opened a new issue #2347:
URL: https://github.com/apache/hudi/issues/2347
I am using the following csv:
+---+-----+
|age| Name|
+---+-----+
| 10| Ajay|
| 20|Bijay|
| 30|Ram|
| 40|Shyam|
| 50| Mina|
+---+-----+
After loading the csv into a dataFrame I am trying to upsert it with "age" as "RECORDKEY" and "Name" as "PRECOMBINE" key. The UPSERT method looks like:
Df.write
.format("hudi")
.option(DataSourceWriteOptions.TABLE_TYPE_OPT_KEY, DataSourceWriteOptions.COW_TABLE_TYPE_OPT_VAL)
.option(DataSourceWriteOptions.RECORDKEY_FIELD_OPT_KEY, "age")
.option(DataSourceWriteOptions.PRECOMBINE_FIELD_OPT_KEY, "Name")
.option(HoodieWriteConfig.TABLE_NAME, tableName)
.option(DataSourceWriteOptions.OPERATION_OPT_KEY, DataSourceWriteOptions.UPSERT_OPERATION_OPT_VAL)
.option("hoodie.upsert.shuffle.parallelism", "2")
.mode(SaveMode.Append)
.save(s"$basePath/$tableName/")
It gives me the error:
org.apache.avro.SchemaParseException: Illegal initial character: 10
at org.apache.avro.Schema.validateName(Schema.java:1147)
at org.apache.avro.Schema.access$200(Schema.java:81)
at org.apache.avro.Schema$Field.<init>(Schema.java:403)
at org.apache.avro.SchemaBuilder$FieldBuilder.completeField(SchemaBuilder.java:2124)
at org.apache.avro.SchemaBuilder$FieldBuilder.completeField(SchemaBuilder.java:2120)
at org.apache.avro.SchemaBuilder$FieldBuilder.access$5200(SchemaBuilder.java:2034)
at org.apache.avro.SchemaBuilder$GenericDefault.noDefault(SchemaBuilder.java:2417)
at org.apache.hudi.spark.org.apache.spark.sql.avro.SchemaConverters$$anonfun$5.apply(SchemaConverters.scala:177)
at org.apache.hudi.spark.org.apache.spark.sql.avro.SchemaConverters$$anonfun$5.apply(SchemaConverters.scala:174)
......
......
......
How to solve this issue?
----------------------------------------------------------------
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
[GitHub] [hudi] bvaradar closed issue #2347: [SUPPORT] UPSERT ON A DATAFRAME LOADED WITH A CSV
Posted by GitBox <gi...@apache.org>.
bvaradar closed issue #2347:
URL: https://github.com/apache/hudi/issues/2347
----------------------------------------------------------------
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
[GitHub] [hudi] bvaradar commented on issue #2347: [SUPPORT] UPSERT ON A DATAFRAME LOADED WITH A CSV
Posted by GitBox <gi...@apache.org>.
bvaradar commented on issue #2347:
URL: https://github.com/apache/hudi/issues/2347#issuecomment-749200972
Please reopen if this is still an issue.
----------------------------------------------------------------
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
[GitHub] [hudi] bvaradar commented on issue #2347: [SUPPORT] UPSERT ON A DATAFRAME LOADED WITH A CSV
Posted by GitBox <gi...@apache.org>.
bvaradar commented on issue #2347:
URL: https://github.com/apache/hudi/issues/2347#issuecomment-748335307
It looks like the csv you are importing does not have the column headers. Spark is treating the first row
"10| Ajay"
as the header with "10" being one of the field name. As Avro field names must begin with an alphabet or "_", it is failing.
----------------------------------------------------------------
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