Uploaded image for project: 'Pig'
  1. Pig
  2. PIG-118

UNION/CROSS/JOIN operations should not allow 1 operand

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.0.0
    • 0.1.0
    • impl
    • None
    • 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);}
      }
      

      Attachments

        1. pig_1operand.patch
          1 kB
          Pi Song

        Activity

          People

            pi_song Pi Song
            pi_song Pi Song
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: