[
https://issues.apache.org/jira/browse/PIG-3833?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13948588#comment-13948588
]
Cheolsoo Park commented on PIG-3833:
------------------------------------
[~jeongjinku], thank you for the patch. It looks good. Do you mind making a
minor change to it?
Instead of duplicating the code, why not call updateSchemaFromInputAvroSchema()
from getInputAvroSchema()? That is-
{code}
public final Schema getInputAvroSchema() {
if (schema == null) {
updateSchemaFromInputAvroSchema();
}
return schema;
}
private final void updateSchemaFromInputAvroSchema() {
String schemaString = getProperties().getProperty(INPUT_AVRO_SCHEMA);
if (schemaString != null) {
Schema s = new Schema.Parser().parse(schemaString);
schema = s;
}
}
{code}
Also, can we make updateSchemaFromInputAvroSchema() private?
If you update the patch, I'll commit it. Thanks!
> Relation loaded by AvroStorage with schema is projected incorrectly in
> foreach statement.
> -----------------------------------------------------------------------------------------
>
> Key: PIG-3833
> URL: https://issues.apache.org/jira/browse/PIG-3833
> Project: Pig
> Issue Type: Bug
> Affects Versions: 0.12.1
> Reporter: Jeongjin Ku
> Assignee: Jeongjin Ku
> Attachments: PIG-3833.patch
>
>
> This example has a correct behavior.
> in = LOAD '$INFILE' USING AvroStorage('','-f schema.avsc');
> out = FOREACH in GENERATE *;
> But if we try to pick and project specific fields like the following example,
> in = LOAD '$INFILE' USING AvroStorage('','-f schema.avsc');
> out = FOREACH in GENERATE $0,$1,$7;
> Actual result is "$0, $1, $2" not "$0,$1,$7"
> This bug is always reproducible.
--
This message was sent by Atlassian JIRA
(v6.2#6252)