[英]How do I get the avro code generator to use a different type, other than the predefined primitive and complex types in schema?
我有一個簡單的avro模式,如下所示:
{
"type": "record",
"name": "transaction",
"namespace": "com.mycompany",
"doc": "Transaction records",
"fields": [
{
"name": "version",
"type": "int",
"default": 1,
"doc": "version the class"
},
{
"name": "eventType",
"type": "string",
"default": "saleTransaction",
"doc": "event type"
},
{
"name": "writeTimestamp",
"type": "org.joda.time.DateTime",
"doc": "Timestamp when this event was written to the stream"
},
{
"name": "originatingClient",
"type": "string",
"doc": "identifier of the originating client"
}
}
使用avro-maven-plugin進行編譯時,出現以下錯誤:
錯誤]無法執行目標
目標org.apache.avro:avro-maven-plugin:1.8.0:schema的執行事務模式失敗:“ org.joda.time.DateTime”不是定義的名稱。 “ writeTimestamp”字段的類型必須是定義的名稱或{“ type”:...}表達式。 -> [幫助1]
我該如何工作?
到目前為止,Avro中沒有日期支持,您必須將時間存儲很長時間。 而且不支持自定義類型,因為這將意味着支持該類型的avro序列化和反序列化。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.