[ 
https://issues.apache.org/jira/browse/AVRO-1392?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13815201#comment-13815201
 ] 

Ryan Blue commented on AVRO-1392:
---------------------------------

No problem if the code is private, I think we have this figured out.

What are you trying to do with the records that you've serialized? I'm 
wondering why we would have told you to add new lines!

Generally, we recommend using Avro to write the files using a 
{{DataFileWriter}}. If your goal is to get your Dataset in HDFS and be able to 
use it easily, that's actually something my project (CDK) is trying to make 
easier than worrying about writing to files yourself. In your case, here's what 
you would do to get started:

{code:java}
DatasetRepository repo = 
DatasetRepositories.open("repo:hdfs:/data/repository"); // wherever you want to 
keep data sets
DatasetDescriptor accountMeta = new 
DatasetDescriptor.Builder().schema(AccountAccess.class).get();
Dataset accounts = repo.create("account_access", accountMeta);

DatasetWriter<AccountAccess> writer = accounts.getWriter();
writer.open()
writer.write( /* an AccountAccess object */ );
writer.close()
{code}

CDK handles all of the things you don't want to care about, like the file 
format. :)

> Unable to marshal enum to Avro
> ------------------------------
>
>                 Key: AVRO-1392
>                 URL: https://issues.apache.org/jira/browse/AVRO-1392
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>         Environment: DEV
>            Reporter: Balaji Seshadri
>            Priority: Blocker
>
> I'm trying to marshall below object to Avro format and unable to marshall it 
> using ReflectDatum Writer.Enums are being rejected while marshalling.
> {code:java}
> public class AccountAccess extends DESBusinessEvent<String> {
>     @XmlElement(required = true)
>     protected String accountId;
>     @XmlElement(required = true)
>     @XmlSchemaType(name = "dateTime")
>     @AvroEncode(using=XmlDateAsLong.class)
>     protected XMLGregorianCalendar dateTime;
> //    @XmlElement(namespace = DESNamespaces.ENUM_NAMESPACE, required = true)
>     @XmlElement(required = true)
>     @Stringable
>     protected ApplicationEnum application;
> //    @XmlElement(namespace = DESNamespaces.ENUM_NAMESPACE, required = true)
>     @XmlElement(required = true)
>     @Stringable
>     protected UserTypeEnum userType;
>     protected String userId;
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to