[ https://issues.apache.org/jira/browse/AVRO-350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12802911#action_12802911 ]
Kevin Oliver commented on AVRO-350: ----------------------------------- Actually, thinking about this a bit more. isSet() seems like a bit of a misnomer, as really we are trying to distinguish between a field existing in the schema or not. Perhaps, hasField(String name) instead? Also, there is already the equivalent of isSet(String name) publicly exposed via GenericRecord.getSchema().getFields().get(name) != null. Adding hasField would just be a convenience method here, do we even need it? I'm leaning towards restoring the pre AVRO-278 behavior of returning null when asking for a field that doesn't exist, and adding comments to get(String name) that explain how null can mean two things: {code} /** * Return the value of a field given its name. * @return null if the given field does not exist in the schema. * You can differentiate between a stored null and not existing in the schema * by introspecting the record's schema. */ Object get(String key); {code} > 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.