我有两种模式:
DataRecord.avsc:
{
"namespace": "com.mycompany",
"type": "record",
"name": "DataRecord",
"fields": [
{"name": "id", "type": ["null", "string"], "default": null},
{"name": "type", "type": ["null", "string"], "default": null},
{"name": "content", "type": ["null", "string"], "default": null},
{"name": "error", "type": ["null", "com.mycompany.Error"], "default": null}
]
}
Error.avsc:
{
"namespace": "com.mycompany",
"type": "error",
"name": "Error",
"fields": [
]
}
它可以与Avro 1.8.2一起使用,但是在我升级到Avro 1.9.0之后,我尝试构建时,它未能编译并生成了以下错误日志:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5:compile (default-compile) on project avro-error-type-missing-custom-coding: Compilation failure: Compilation failure:
[ERROR] /workspaces/myspace/avro-error-type-missing-custom-coding/target/generated-sources/avro/com/mycompany/DataRecord.java:[570,17] cannot find symbol
[ERROR] symbol: method customEncode(org.apache.avro.io.Encoder)
[ERROR] location: variable error of type com.mycompany.Error
[ERROR] /workspaces/myspace/avro-error-type-missing-custom-coding/target/generated-sources/avro/com/mycompany/DataRecord.java:[608,19] cannot find symbol
[ERROR] symbol: method customDecode(org.apache.avro.io.ResolvingDecoder)
在Avro 1.9.0中,SpecificRecordBase似乎具有customEncode()
和customDecode()
的方法,但是SpecificExceptionBase没有。
如何解决此问题?