You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Koji Noguchi (Jira)" <ji...@apache.org> on 2020/10/12 19:35:00 UTC

[jira] [Commented] (PIG-5243) describe with typecast on as-clause shows the types before the typecasting

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

Koji Noguchi commented on PIG-5243:
-----------------------------------

This bug made the debugging harder in PIG-5404. Looking.

This is happening because we have
{code:java|title=PigServer.Graph}
private Map<String, Operator> operators = new HashMap<String, Operator>();
...
private LogicalPlan lp;
...
{code}
{{operators}} and {{lp}} are both initialized at
{code:java}
  1827                 QueryParserDriver parserDriver = new QueryParserDriver( pigContext, scope, fileNameMap );
  1828                 lp = parserDriver.parse( query );
  1829                 operators = parserDriver.getOperators();
  1830                 lastRel = parserDriver.getLastRel();
{code}
These {{operators}} and {{lp}} are consistent at this point. 
 But later, we update the logical plan later by calling
{code:java}
  1859         private void compile() throws IOException {
  1860             lp.validate(pigContext, scope, false);
  1861             ...
  1862         }
{code}
As part of this LogicalPlan.validate(), we split the as-clause foreach into two separate foreach (PIG-2315).
 (a) Original Foreach 
 followed by a 
 (b) TypeCast Foreach.

It is only this (b) TypeCast Foreach that is keeping the user's declared types but 
 PigServer.Graph.operators is still pointing to (a) Original Foreach.

> describe with typecast on as-clause shows the types before the typecasting
> --------------------------------------------------------------------------
>
>                 Key: PIG-5243
>                 URL: https://issues.apache.org/jira/browse/PIG-5243
>             Project: Pig
>          Issue Type: Bug
>            Reporter: Koji Noguchi
>            Assignee: Koji Noguchi
>            Priority: Minor
>
> For code like 
> {code}
> a = load 'test.txt' as (mytuple:tuple (), gpa:float);
> b = foreach a generate mytuple as (mytuple2:(name:int, age:double));
> store b into '/tmp/deleteme';
> {code}
> {{describe b}} shows 
> {noformat}
> b: {mytuple2: (name: bytearray,age: bytearray)}
> {noformat}
> Execution wise, it is fine since there is an extra foreach typecasting the above relation.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)