liyunzhang_intel created PIG-4968:
-------------------------------------
Summary: Fix unit test failure of
TestLogicalPlanBuilder#testQuery90
Key: PIG-4968
URL: https://issues.apache.org/jira/browse/PIG-4968
Project: Pig
Issue Type: Bug
Reporter: liyunzhang_intel
Assignee: liyunzhang_intel
In jenkins, [it
|https://builds.apache.org/job/Pig-trunk/1935/#showFailuresLink] shows that
TestLogicalPlanBuilder#testQuery90 fails. After debugging, it always fails in
[Line1139
|https://github.com/apache/pig/blob/trunk/test/org/apache/pig/test/TestLogicalPlanBuilder.java#L1138]
{code}
Assert.assertTrue(foreach.getSchema().toString( false
).equals("mygroup:tuple(myname:chararray,myage:int),mycount:long"));
{code}
The script is
{code}
a = load 'myfile' as (name:Chararray, age:Int, gpa:Float);b = group a by (name,
age);c = foreach b generate group as mygroup:(myname, myage), COUNT(a) as
mycount;store c into 'output';
{code}
The reason why fails is because the schema of mygroup(myname,myage) is
mygroup(myname:bytearray,myage:bytearray) and this user-defined schema is
assigned to c. so the schema of c is
not mygroup:tuple(myname:chararray,myage:int) but
mygroup:tuple(myname:bytearray,myage:bytearray).
This problem is imported since PIG-2315 as ForEachUserSchemaVisitor is used in
[LogicalPlan|https://github.com/apache/pig/blob/trunk/src/org/apache/pig/newplan/logical/relational/LogicalPlan.java#L179].
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)