1. Pig
  2. PIG-2216

deprecate use of type in as clause of foreach statement


    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:


      In the as clause of foreach statement, type can be specified, but that type is actually not used (ie, it does not result in a cast). This behavior is misleading.

      F = foreach INP generate c1 as (name : chararray);

      Pig 0.8 produces an error if c1 in above example is not of same type as specified in the as clause.
      In 0.9, that check seems to have been lost in the parser migration. It also results in the logical plan thinking that the type of c1 is that specified in the as clause. That can cause errors such as ClassCastException.

      One way to be consistent here would have been to add cast for the as clause as well. But having two ways to cast complicates things. So long term, I think the use of types in as clause should be removed.

      For 0.10, i think the check present in 0.8 should be added back, and the syntax should be deprecated (resulting in a warning when used).

        Issue Links


          Thejas M Nair created issue -
          Olga Natkovich made changes -
          Field Original Value New Value
          Fix Version/s 0.10 [ 12316246 ]
          Daniel Dai added a comment -

          This is the same issue of PIG-2315. Mark this issue as duplicate.

          Daniel Dai added a comment - This is the same issue of PIG-2315 . Mark this issue as duplicate.
          Daniel Dai made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Duplicate [ 3 ]
          Thejas M Nair made changes -
          Link This issue duplicates PIG-2315 [ PIG-2315 ]
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Resolved Resolved
          217d 2m 1 Daniel Dai 15/Mar/12 18:26


            • Assignee:
              Thejas M Nair
            • Votes:
              0 Vote for this issue
              1 Start watching this issue


              • Created: