Closed mostafa-asg closed 4 years ago
Hello, the avro data are missing required field LP_PostalProvince__c. That means the data are incorrect or you have wrong schema. Either way it's not an Abris issue.
Could you double check that the schema coordinates that you are using are referring to the correct schema?
If you still think that it's Abris issue let us please know the version you are using.
Thanks for your answer,
I debugged the code, in class AvroDataToCatalyst
, method decodeConfluentAvro
, it gets writerSchema
correctly, but avroSchema
in the next line is totally different from writerSchema
:
reader = new GenericDatumReader[Any](writerSchema, avroSchema)
Here is just the head of those schema: writerSchema:
{
"type": "record",
"name": "Account",
"namespace": "io.confluent.salesforce",
"fields": [
{
"name": "Id",
"type": {
"type": "string",
"connect.doc": "Unique identifier for the object."
},
"doc": "Unique identifier for the object."
},
{
"name": "IsDeleted",
"type": [
"null",
"boolean"
],
"default": null
},
.....
avroSchema:
{
"type": "record",
"name": "defaultName",
"namespace": "defaultNamespace",
"fields": [
{
"name": "Id",
"type": [
"string",
"null"
]
},
{
"name": "Company",
"type": [
"string",
"null"
]
},
.....
I also deserialized the record manually, it deserialized correctly, so the binary format is correct.
I think I missed something in configuration. From where avroSchema
was populated?
What version of Abris do you use? It may be important.
Both schemas must be compatible. If you don't care about schema evolution you can just use the same schema.
To get the correct schema you have to fix the config, take a look at the documentation https://docs.confluent.io/current/schema-registry/serdes-develop/index.html the naming strategies is what you need to configure. And also id or version.
you can try it like this:
val schema = SchemaManagerFactory.create(schemaRegistryConf).downloadSchema()
If you provide correct schemaRegistryConf
it should return the correct schema.
@cerveada Thanks for your help
Sorry, but that was my mistake.
I set the topic name here wrongly:
SchemaManager.PARAM_SCHEMA_REGISTRY_TOPIC -> "topicName",
Hello, thanks for open sourcing this project. We are using ABRiS to read
Confluent Avro Records
from Kafka. The records are Salesforce, produced by Kafka Connect. When we read data with the help offrom_confluent_avro
, we get this error:org.apache.avro.AvroTypeException: Found io.confluent.ksql.avro_schemas.KsqlDataSourceSchema, expecting defaultNamespace.defaultName, missing required field LP_PostalProvince__c
Here are configs:
And usage
Full error:
Any idea what's the problem?