13. Exception 覦
C:a>java -jar avro-tools-1.5.4.jar idl helloworld.genavro helloworld.avpr
Exception in thread "main" org.apache.avro.compiler.idl.ParseException:
Undefine
d name '.String', at line 4, column 9
at org.apache.avro.compiler.idl.Idl.error(Idl.java:48)
at org.apache.avro.compiler.idl.Idl.ReferenceType(Idl.java:750)
at org.apache.avro.compiler.idl.Idl.Type(Idl.java:670)
at org.apache.avro.compiler.idl.Idl.ResultType(Idl.java:821)
at org.apache.avro.compiler.idl.Idl.MessageDeclaration(Idl.java:565)
at org.apache.avro.compiler.idl.Idl.ProtocolBody(Idl.java:342)
at org.apache.avro.compiler.idl.Idl.ProtocolDeclaration(Idl.java:206)
at org.apache.avro.compiler.idl.Idl.CompilationUnit(Idl.java:84)
at org.apache.avro.tool.IdlTool.run(IdlTool.java:65)
at org.apache.avro.tool.Main.run(Main.java:74)
at org.apache.avro.tool.Main.main(Main.java:63)
14. Avro tool
compile : Generates Java code for the given schema.
fragtojson : Renders a binary-encoded Avro datum as JSON.
fromjson : Reads JSON records and writes an Avro data file.
genavro : Generates a JSON schema from a GenAvro file
getschema : Prints out schema of an Avro data file.
induce : Induce a schema/protocol from Java class/interface.
jsontofrag : Renders a JSON-encoded Avro datum as binary.
rpcreceive : Opens an HTTP RPC Server and listens for one
message.
rpcsend : Sends a single RPC message.
tojson : Dumps an Avro data file as JSON, one record per
line.
16. 轟
a data serialization system.
Protocol buffer Thrift 願鍵譬螳 旧 襭
覦, Avro serialization 讌譴 旧 襭.
轟
Schema language, cross language
Rich data structures.
A compact, fast, binary data format.
A container file, to store persistent data.
Remote procedure call (RPC).
. 1.3.0覿 讌 (ipc れ 豢螳)
Simple integration with dynamic languages.
Language : C, C++, Java, PHP, Python, Ruby
17. 轟
Main developer and created by
Doug Cutting
Doug Cutting said Avro will replace
Hadoops existing RPC
http://www.cloudera.com/blog/2009/11/avro
-a-new-format-for-data-interchange/
18. 轟
Avro is replacing Thrift as the RPC client for
interacting with Cassandra.
Avro is a sub-project of the Apache
Hadoop project
dynamic data serialization library that has
an advantage over Thrift in that it does not
require static code generation.
org.apache.cassandra.thrift.CassandraServer
=>
org.apache.cassandra.avro.CassandraServer
19. Type
Primitive
string
bytes : byte 覦一
int
long
float
double
Boolean
null
Complex
record : struct 螳 螳
name : 貊 企
doc : ろる る
fields : , name, doc, type, default
array
Items
map
value
Union
name, size
fixed (螻蠍語)
enum
name, doc, symbols