Initial import into git.
[galago.git] / java / pig-galago / src / com / yahoo / pig / impl / physicalLayer / PhysicalOperator.java
blob1a897a7f7f872c7132fe0225f7b693d7f136df33
1 /*
2 * Copyright (c) 2007 Yahoo! Inc. All rights reserved.
3 * See accompanying LICENSE file.
4 */
5 package com.yahoo.pig.impl.physicalLayer;
7 import java.io.IOException;
8 import java.io.Serializable;
10 import com.yahoo.pig.data.Tuple;
11 import com.yahoo.pig.impl.logicalLayer.LogicalOperator;
13 abstract public class PhysicalOperator implements Serializable {
15 public PhysicalOperator[] inputs = null;
16 int outputType;
18 /**
20 * This constructor should go away when we eventually implement CQ even for the mapreduce exec type
22 public PhysicalOperator(){
23 outputType = LogicalOperator.FIXED;
27 public PhysicalOperator(int outputType){
28 this.outputType = outputType;
31 public boolean open(boolean continueFromLast) throws IOException {
32 // call open() on all inputs
33 if (inputs != null) {
34 for (int i = 0; i < inputs.length; i++) {
35 if (!inputs[i].open(continueFromLast))
36 return false;
39 return true;
42 abstract public Tuple getNext() throws IOException;
44 public void close() throws IOException {
45 // call close() on all inputs
46 if (inputs != null)
47 for (int i = 0; i < inputs.length; i++)
48 inputs[i].close();
51 public int getOutputType(){
52 return outputType;