Pig
  1. Pig
  2. PIG-118

UNION/CROSS/JOIN operations should not allow 1 operand

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.0.0
    • Fix Version/s: 0.1.0
    • Component/s: impl
    • Labels:
      None
    • Patch Info:
      Patch Available

      Description

      At the moment UNION/CROSS/JOIN allow 1 operand.

      You can write:-

      b = UNION a ;
      c = CROSS b ;
      d = JOIN c BY $0 ;
      

      Possibly UNION with 1 operand might be needed for implementing Sigma-styled union (Ui=1..n An) but for CROSS/JOIN I think nobody would do such operation.

      By simply replacing "*" with "+" in the parser tree should fix this problem. Should this be fixed?

      LogicalOperator CrossClause() : {LogicalOperator op; ArrayList<OperatorKey> inputs = new ArrayList<OperatorKey>();}
      {
      	(
      	op = NestedExpr() { inputs.add(op.getOperatorKey()); }
      	("," op = NestedExpr() { inputs.add(op.getOperatorKey()); })*
      	)
      	{return rewriteCross(inputs);}
      }
      
      LogicalOperator JoinClause() : {CogroupInput gi; ArrayList<CogroupInput> gis = new ArrayList<CogroupInput>();}
      {
      	(gi = GroupItem() { gis.add(gi); }
      	("," gi = GroupItem() { gis.add(gi); })*)
      	{return rewriteJoin(gis);}
      }
      
      LogicalOperator UnionClause() : {LogicalOperator op; ArrayList<OperatorKey> inputs = new ArrayList<OperatorKey>();}
      {
      	(op = NestedExpr() { inputs.add(op.getOperatorKey()); }
      	("," op = NestedExpr() { inputs.add(op.getOperatorKey()); })*)
      	{return new LOUnion(opTable, scope, getNextId(), inputs);}
      }
      

        Activity

        Pi Song created issue -
        Hide
        Pi Song added a comment - - edited

        This patch solves the above issue.

        All unit tests passed.

        I assume Sigma-styled Union/Cross/Join are not in the plan.

        Show
        Pi Song added a comment - - edited This patch solves the above issue. All unit tests passed. I assume Sigma-styled Union/Cross/Join are not in the plan.
        Pi Song made changes -
        Field Original Value New Value
        Attachment pig_1operand.patch [ 12376717 ]
        Hide
        Pi Song added a comment -

        After applying this patch when only one operand is found for these operators, you will get " , expected" message which I think is good enough.

        Show
        Pi Song added a comment - After applying this patch when only one operand is found for these operators, you will get " , expected" message which I think is good enough.
        Olga Natkovich made changes -
        Patch Info [Patch Available]
        Hide
        Olga Natkovich added a comment -

        fixes committed. Thanks, Pi.

        Show
        Olga Natkovich added a comment - fixes committed. Thanks, Pi.
        Olga Natkovich made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Owen O'Malley made changes -
        Workflow jira [ 12424296 ] no-reopen-closed, patch-avail [ 12425448 ]
        Olga Natkovich made changes -
        Fix Version/s 0.1.0 [ 12312848 ]
        Alan Gates made changes -
        Assignee Pi Song [ pi_song ]
        Alan Gates made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        10d 1h 23m 1 Olga Natkovich 05/Mar/08 02:01
        Resolved Resolved Closed Closed
        749d 19h 59m 1 Alan Gates 24/Mar/10 22:01

          People

          • Assignee:
            Pi Song
            Reporter:
            Pi Song
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development