avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Oliver (JIRA)" <j...@apache.org>
Subject [jira] Commented: (AVRO-350) NPE on GenericData.Record.get(String) for a field that doesn't exist
Date Tue, 19 Jan 2010 18:56:56 GMT

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

Kevin Oliver commented on AVRO-350:
-----------------------------------

There is a tradeoff with isSet(). If you don't know if the field is in a schema, you would
then need to always precede every call to get() with isSet(). 

I tend to think of the GenericRecords as modeling a map, but maybe that is not the right approach.


A compromise might be returning null when not set, and if an application is interested, they
can see if the value isSet(). That feels like a nice balance between performance and features.

> NPE on GenericData.Record.get(String) for a field that doesn't exist
> --------------------------------------------------------------------
>
>                 Key: AVRO-350
>                 URL: https://issues.apache.org/jira/browse/AVRO-350
>             Project: Avro
>          Issue Type: Sub-task
>          Components: java
>    Affects Versions: 1.3.0
>            Reporter: Kevin Oliver
>         Attachments: AVRO-350.patch
>
>
> After the change in AVRO-278 to use arrays, GenericData.Record.get() gives an NPE if
you ask for a field that doesn't exist in the schema. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message