druid kafka索引服务使用avro架构错误(avrotypeexception:字段的默认值无效)

nzkunb0c  于 2021-06-26  发布在  Java
关注(0)|答案(0)|浏览(217)

apachedruidkafka索引服务使用avro\u流作为解析器类型,使用avrobytesdecoder set类型schema\u registry和url schema registry url。当consume kafka data and logparseexceptions为true时,获取以下日志:

2021-01-06T02:48:33,022 ERROR [task-runner-0-priority-0] org.apache.druid.indexing.seekablestream.SeekableStreamIndexTaskRunner - Encountered parse exception on row from partition[10] sequenceNumber[101782492]
org.apache.druid.java.util.common.parsers.ParseException: Fail to decode avro message!
  at org.apache.druid.data.input.avro.SchemaRegistryBasedAvroBytesDecoder.parse(SchemaRegistryBasedAvroBytesDecoder.java:71) ~[?:?]
  at org.apache.druid.data.input.AvroStreamInputRowParser.parseBatch(AvroStreamInputRowParser.java:58) ~[?:?]
  at org.apache.druid.data.input.AvroStreamInputRowParser.parseBatch(AvroStreamInputRowParser.java:36) ~[?:?]
  at org.apache.druid.segment.transform.TransformingInputRowParser.parseBatch(TransformingInputRowParser.java:50) ~[druid-processing-0.16.0-incubating.jar:0.16.0-incubating]
  at org.apache.druid.indexing.seekablestream.SeekableStreamIndexTaskRunner.runInternal(SeekableStreamIndexTaskRunner.java:604) [druid-indexing-service-0.16.0-incubating.jar:0.16.0-incubating]
  at org.apache.druid.indexing.seekablestream.SeekableStreamIndexTaskRunner.run(SeekableStreamIndexTaskRunner.java:259) [druid-indexing-service-0.16.0-incubating.jar:0.16.0-incubating]
  at org.apache.druid.indexing.seekablestream.SeekableStreamIndexTask.run(SeekableStreamIndexTask.java:177) [druid-indexing-service-0.16.0-incubating.jar:0.16.0-incubating]
  at org.apache.druid.indexing.overlord.SingleTaskBackgroundRunner$SingleTaskBackgroundRunnerCallable.call(SingleTaskBackgroundRunner.java:419) [druid-indexing-service-0.16.0-incubating.jar:0.16.0-incubating]
  at org.apache.druid.indexing.overlord.SingleTaskBackgroundRunner$SingleTaskBackgroundRunnerCallable.call(SingleTaskBackgroundRunner.java:391) [druid-indexing-service-0.16.0-incubating.jar:0.16.0-incubating]
  at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_252]
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_252]
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_252]
  at java.lang.Thread.run(Thread.java:748) [?:1.8.0_252]
Caused by: org.apache.avro.AvroTypeException: Invalid default for field campaign_type: 1 not a ["null","int"]
  at org.apache.avro.Schema.validateDefault(Schema.java:1512) ~[?:?]
  at org.apache.avro.Schema.access$300(Schema.java:86) ~[?:?]
  at org.apache.avro.Schema$Field.<init>(Schema.java:493) ~[?:?]
  at org.apache.avro.Schema.parse(Schema.java:1619) ~[?:?]
  at org.apache.avro.Schema$Parser.parse(Schema.java:1366) ~[?:?]
  at org.apache.avro.Schema$Parser.parse(Schema.java:1354) ~[?:?]
  at io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient.getSchemaByIdFromRegistry(CachedSchemaRegistryClient.java:63) ~[?:?]
  at io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient.getBySubjectAndID(CachedSchemaRegistryClient.java:117) ~[?:?]
  at io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient.getByID(CachedSchemaRegistryClient.java:99) ~[?:?]
  at org.apache.druid.data.input.avro.SchemaRegistryBasedAvroBytesDecoder.parse(SchemaRegistryBasedAvroBytesDecoder.java:66) ~[?:?]
  ... 12 more

这是我关于该领域的avro文件:

{ "name": "campaign_type", "type": ["null", "int"], "default": 1}

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题