avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <cutt...@apache.org>
Subject Re: Undefined name: "enum"
Date Mon, 02 Aug 2010 15:59:50 GMT
The sourceComponentTypeField should look something like:

{"name": "sourceComponentType",
  "type": {"type": "enum", "symbols": [ ... ] }
}

This is the same error message that confused Sam in:

https://issues.apache.org/jira/browse/AVRO-583

Doug

On 08/02/2010 08:46 AM, Tim Robertson wrote:
> Hi all,
>
> I am new to avro, and using it to implement an http RPC transport
> layer to allow distributed components to push to a centralised event
> log.
>
> I have the following types in my .avpr:
>
>   "types": [
>       {"name": "Event", "type": "record",
>        "fields": [
>            {"name": "message", "type": "string"},
>            {
>            	"type": "enum",
>            	"name": "sourceComponentType",
>            	"symbols" : ["OCCURRENCE_HARVESTER", "CHECKLIST_HARVESTER", "USER"]
>            },
>            {"name": "instanceId", "type": "string"},
>            {"name": "sessionId", "type": "string", "default": null},
>            {"name": "count", "type": "int", "default": 0},
>            {"name": "sourceId", "type": "string"},
>            {"name": "userId", "type": "string"},
>            {
>            	"type": "enum",
>            	"name": "level",
>            	"symbols" : ["DEBUG", "INFO", "WARN", "ERROR"]
>            },
>            {"name": "agentId", "type": "string"},
>            {
>            	"type": "enum",
>            	"name": "objectType",
>            	"symbols" : ["OCCURRENCE", "NAME_USAGE"]
>            },
>            {"name": "objectId", "type": "string"},
>            {"name": "message", "type": "string"},
>            {"name": "sensitive", "type": "boolean", "default": "false"}
>        ]
>       }
>
> but on protocol compilation get:
>
> org.apache.avro.SchemaParseException: Undefined name: "enum"
> 	at org.apache.avro.Schema.parse(Schema.java:876)
> 	at org.apache.avro.Schema.parse(Schema.java:912)
> 	at org.apache.avro.Protocol.parseTypes(Protocol.java:325)
> 	at org.apache.avro.Protocol.parse(Protocol.java:288)
> 	at org.apache.avro.Protocol.parse(Protocol.java:278)
> 	at org.apache.avro.Protocol.parse(Protocol.java:262)
> 	at org.apache.avro.specific.SpecificCompiler.compileProtocol(SpecificCompiler.java:104)
> 	at org.apache.avro.mojo.AvroMojo.execute(AvroMojo.java:163)
> 	at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
> 	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
> 	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
> 	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
> 	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
> 	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
> 	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
> 	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
> 	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
> 	at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
> 	at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
> 	at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
> 	at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
> 	at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
>
>
> Can someone spot an error please?  I'm on 1.3.3 and just copied the
> example in the docs on
> http://avro.apache.org/docs/1.3.3/spec.html#Enums
>
> Thanks,
> Tim

Mime
View raw message