You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by ga...@apache.org on 2008/05/14 00:52:03 UTC

svn commit: r656043 [2/3] - in /incubator/pig/branches/types: lib-src/bzip2/org/apache/tools/bzip2r/ lib-src/shock/org/apache/pig/shock/ src/org/apache/pig/builtin/ src/org/apache/pig/impl/logicalLayer/ src/org/apache/pig/impl/logicalLayer/validators/ ...

Modified: incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOProject.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOProject.java?rev=656043&r1=656042&r2=656043&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOProject.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOProject.java Tue May 13 15:52:02 2008
@@ -62,7 +62,7 @@
     private List<Integer> mProjection;
     private boolean mIsStar = false;
     private static Log log = LogFactory.getLog(LOProject.class);
-	private boolean mSentinel;
+    private boolean mSentinel;
 
     /**
      * 
@@ -80,11 +80,11 @@
         super(plan, key);
         mExp = exp;
         mProjection = projection;
-		if(mExp instanceof ExpressionOperator) {
-			mSentinel = false;
-		} else {
-			mSentinel = true;
-		}
+        if(mExp instanceof ExpressionOperator) {
+            mSentinel = false;
+        } else {
+            mSentinel = true;
+        }
     }
 
     /**
@@ -104,11 +104,11 @@
         mExp = exp;
         mProjection = new ArrayList<Integer>(1);
         mProjection.add(projection);
-		if(mExp instanceof ExpressionOperator) {
-			mSentinel = false;
-		} else {
-			mSentinel = true;
-		}
+        if(mExp instanceof ExpressionOperator) {
+            mSentinel = false;
+        } else {
+            mSentinel = true;
+        }
     }
 
     public LogicalOperator getExpression() {
@@ -153,13 +153,13 @@
     @Override
     public Schema.FieldSchema getFieldSchema() throws FrontendException {
         log.debug("Inside getFieldSchemas");
-		log.debug("Number of columns: " + mProjection.size());
+        log.debug("Number of columns: " + mProjection.size());
         for (int i : mProjection) {
             log.debug("Column: " + i);
         }
-		LogicalOperator expressionOperator = mExp;
-		log.debug("expressionOperator = " + expressionOperator);
-		log.debug("mIsStar: " + mIsStar);
+        LogicalOperator expressionOperator = mExp;
+        log.debug("expressionOperator = " + expressionOperator);
+        log.debug("mIsStar: " + mIsStar);
 
         if (!mIsFieldSchemaComputed && (null == mFieldSchema)) {
 
@@ -169,23 +169,23 @@
                     if (null != expressionOperator) {
                         log.debug("expressionOperator is not null "
                                 + expressionOperator.getClass().getName() + " " + expressionOperator);
-						if(!mSentinel) {
-							//we have an expression operator and hence a list of field shcemas
-							mFieldSchema = ((ExpressionOperator)expressionOperator).getFieldSchema();
-						} else {
-							//we have a relational operator as input and hence a schema
-							log.debug("expression operator alias: " + expressionOperator.getAlias());
-							log.debug("expression operator schema: " + expressionOperator.getSchema());
-							log.debug("expression operator type: " + expressionOperator.getType());
-							//TODO
-							//the type of the operator will be unkown. when type checking is in place
-							//add the type of the operator as a parameter to the fieldschema creation
-							//mFieldSchema = new Schema.FieldSchema(expressionOperator.getAlias(), expressionOperator.getSchema(), expressionOperator.getType());
-							mFieldSchema = new Schema.FieldSchema(expressionOperator.getAlias(), expressionOperator.getSchema());
-                    	}
-					} else {
-						log.warn("The input for a projection operator cannot be null");
-					}
+                        if(!mSentinel) {
+                            //we have an expression operator and hence a list of field shcemas
+                            mFieldSchema = ((ExpressionOperator)expressionOperator).getFieldSchema();
+                        } else {
+                            //we have a relational operator as input and hence a schema
+                            log.debug("expression operator alias: " + expressionOperator.getAlias());
+                            log.debug("expression operator schema: " + expressionOperator.getSchema());
+                            log.debug("expression operator type: " + expressionOperator.getType());
+                            //TODO
+                            //the type of the operator will be unkown. when type checking is in place
+                            //add the type of the operator as a parameter to the fieldschema creation
+                            //mFieldSchema = new Schema.FieldSchema(expressionOperator.getAlias(), expressionOperator.getSchema(), expressionOperator.getType());
+                            mFieldSchema = new Schema.FieldSchema(expressionOperator.getAlias(), expressionOperator.getSchema());
+                        }
+                    } else {
+                        log.warn("The input for a projection operator cannot be null");
+                    }
                     mIsFieldSchemaComputed = true;
                 } catch (FrontendException fee) {
                     mFieldSchema = null;
@@ -196,78 +196,78 @@
                 log.debug("Exiting getSchema()");
                 return mFieldSchema;
             } else {
-				//its n list of columns to project including a single column
+                //its n list of columns to project including a single column
                 List<Schema.FieldSchema> fss = new ArrayList<Schema.FieldSchema>(mProjection.size());
-				try {
-	                if (null != expressionOperator) {
-	                    log.debug("expressionOperator is not null");
-						if(mProjection.size() == 1) {
-							//if there is only one element then extract and return the field schema
-							log.debug("Only one element");
-							if(!mSentinel) {
-								log.debug("Input is an expression operator");
-								Schema.FieldSchema expOpFs = ((ExpressionOperator)expressionOperator).getFieldSchema();
-								if(null != expOpFs) {
-									Schema s = expOpFs.schema;
-									if(null != s) {
-										mFieldSchema = s.getField(mProjection.get(0));
-									} else {
-										mFieldSchema = new Schema.FieldSchema(null, DataType.BYTEARRAY);
-									}
-								} else {
-									mFieldSchema = new Schema.FieldSchema(null, DataType.BYTEARRAY);
-								}
-							} else {
-								log.debug("Input is a logical operator");
-	                       		Schema s = expressionOperator.getSchema();
-	                    		log.debug("s: " + s);
-								if(null != s) {
-	                            	mFieldSchema = s.getField(mProjection.get(0));
-									log.debug("mFieldSchema alias: " + mFieldSchema.alias);
-									log.debug("mFieldSchema schema: " + mFieldSchema.schema);
-								} else {
-									mFieldSchema = new Schema.FieldSchema(null, DataType.BYTEARRAY);
-								}
-							}
-							mIsFieldSchemaComputed = true;
-							return mFieldSchema;
-						}
-						
-	                    for (int colNum : mProjection) {
-	                        log.debug("Col: " + colNum);
-							if(!mSentinel) {
-								Schema.FieldSchema expOpFs = ((ExpressionOperator)expressionOperator).getFieldSchema();
-								if(null != expOpFs) {
-									Schema s = expOpFs.schema;
-									if(null != s) {
-										fss.add(s.getField(colNum));
-									} else {
-										fss.add(new Schema.FieldSchema(null, DataType.BYTEARRAY));
-									}
-								} else {
-									fss.add(new Schema.FieldSchema(null, DataType.BYTEARRAY));
-								}
-							} else {
-								Schema s = expressionOperator.getSchema();
-								if(null != s) {
-									fss.add(s.getField(colNum));
-								} else {
-									fss.add(new Schema.FieldSchema(null, DataType.BYTEARRAY));
-								}
-							}
-						}
-	
-	                } else {
-						log.warn("The input for a projection operator cannot be null");
-	                    //fss.add(new Schema.FieldSchema(null, DataType.BYTEARRAY));
-	                }
-				} catch(ParseException pe) {
-					mFieldSchema = null;
-					mIsFieldSchemaComputed = false;
-					throw new FrontendException(pe.getMessage());
-				}
-				mFieldSchema = new Schema.FieldSchema(expressionOperator.getAlias(), new Schema(fss));
-				mIsFieldSchemaComputed = true;
+                try {
+                    if (null != expressionOperator) {
+                        log.debug("expressionOperator is not null");
+                        if(mProjection.size() == 1) {
+                            //if there is only one element then extract and return the field schema
+                            log.debug("Only one element");
+                            if(!mSentinel) {
+                                log.debug("Input is an expression operator");
+                                Schema.FieldSchema expOpFs = ((ExpressionOperator)expressionOperator).getFieldSchema();
+                                if(null != expOpFs) {
+                                    Schema s = expOpFs.schema;
+                                    if(null != s) {
+                                        mFieldSchema = s.getField(mProjection.get(0));
+                                    } else {
+                                        mFieldSchema = new Schema.FieldSchema(null, DataType.BYTEARRAY);
+                                    }
+                                } else {
+                                    mFieldSchema = new Schema.FieldSchema(null, DataType.BYTEARRAY);
+                                }
+                            } else {
+                                log.debug("Input is a logical operator");
+                                   Schema s = expressionOperator.getSchema();
+                                log.debug("s: " + s);
+                                if(null != s) {
+                                    mFieldSchema = s.getField(mProjection.get(0));
+                                    log.debug("mFieldSchema alias: " + mFieldSchema.alias);
+                                    log.debug("mFieldSchema schema: " + mFieldSchema.schema);
+                                } else {
+                                    mFieldSchema = new Schema.FieldSchema(null, DataType.BYTEARRAY);
+                                }
+                            }
+                            mIsFieldSchemaComputed = true;
+                            return mFieldSchema;
+                        }
+                        
+                        for (int colNum : mProjection) {
+                            log.debug("Col: " + colNum);
+                            if(!mSentinel) {
+                                Schema.FieldSchema expOpFs = ((ExpressionOperator)expressionOperator).getFieldSchema();
+                                if(null != expOpFs) {
+                                    Schema s = expOpFs.schema;
+                                    if(null != s) {
+                                        fss.add(s.getField(colNum));
+                                    } else {
+                                        fss.add(new Schema.FieldSchema(null, DataType.BYTEARRAY));
+                                    }
+                                } else {
+                                    fss.add(new Schema.FieldSchema(null, DataType.BYTEARRAY));
+                                }
+                            } else {
+                                Schema s = expressionOperator.getSchema();
+                                if(null != s) {
+                                    fss.add(s.getField(colNum));
+                                } else {
+                                    fss.add(new Schema.FieldSchema(null, DataType.BYTEARRAY));
+                                }
+                            }
+                        }
+    
+                    } else {
+                        log.warn("The input for a projection operator cannot be null");
+                        //fss.add(new Schema.FieldSchema(null, DataType.BYTEARRAY));
+                    }
+                } catch(ParseException pe) {
+                    mFieldSchema = null;
+                    mIsFieldSchemaComputed = false;
+                    throw new FrontendException(pe.getMessage());
+                }
+                mFieldSchema = new Schema.FieldSchema(expressionOperator.getAlias(), new Schema(fss));
+                mIsFieldSchemaComputed = true;
                 log.debug("mIsStar is false, returning computed field schema of expressionOperator");
             }
         }

Modified: incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOSort.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOSort.java?rev=656043&r1=656042&r2=656043&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOSort.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOSort.java Tue May 13 15:52:02 2008
@@ -37,7 +37,7 @@
     private String mSortFunc;
     private boolean mIsStar = false;
     private List<LogicalPlan> mSortColPlans;
-	private static Log log = LogFactory.getLog(LOSort.class);
+    private static Log log = LogFactory.getLog(LOSort.class);
 
     /**
      * @param plan

Modified: incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOSplit.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOSplit.java?rev=656043&r1=656042&r2=656043&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOSplit.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOSplit.java Tue May 13 15:52:02 2008
@@ -35,7 +35,7 @@
 
     private Map<String, LogicalPlan> mCondPlans;
     private ArrayList<LogicalOperator> mOutputs;
-	private static Log log = LogFactory.getLog(LOSplit.class);
+    private static Log log = LogFactory.getLog(LOSplit.class);
 
     /**
      * @param plan

Modified: incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOStore.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOStore.java?rev=656043&r1=656042&r2=656043&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOStore.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOStore.java Tue May 13 15:52:02 2008
@@ -37,7 +37,7 @@
 
     private FileSpec mOutputFile;
     private StoreFunc mStoreFunc;
-	private static Log log = LogFactory.getLog(LOStore.class);
+    private static Log log = LogFactory.getLog(LOStore.class);
 
     /**
      * @param plan
@@ -61,12 +61,12 @@
         // Also remove the commented out import org.apache.pig.impl.PigContext
 
         try { 
-		 	mStoreFunc = (StoreFunc) PigContext.instantiateFuncFromSpec(outputFileSpec.getFuncSpec()); 
-		} catch (Exception e) { 
-			IOException ioe = new IOException(e.getMessage()); 
-			ioe.setStackTrace(e.getStackTrace());
-			throw ioe; 
-		}
+             mStoreFunc = (StoreFunc) PigContext.instantiateFuncFromSpec(outputFileSpec.getFuncSpec()); 
+        } catch (Exception e) { 
+            IOException ioe = new IOException(e.getMessage()); 
+            ioe.setStackTrace(e.getStackTrace());
+            throw ioe; 
+        }
     }
 
     public FileSpec getOutputFile() {

Modified: incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOUnion.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOUnion.java?rev=656043&r1=656042&r2=656043&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOUnion.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOUnion.java Tue May 13 15:52:02 2008
@@ -31,7 +31,7 @@
 
     private static final long serialVersionUID = 2L;
     private ArrayList<LogicalOperator> mInputs;
-	private static Log log = LogFactory.getLog(LOUnion.class);
+    private static Log log = LogFactory.getLog(LOUnion.class);
 
     /**
      * @param plan
@@ -59,26 +59,26 @@
     public Schema getSchema() throws FrontendException {
         if (!mIsSchemaComputed && (null == mSchema)) {
             Collection<LogicalOperator> s = mPlan.getPredecessors(this);
-			log.debug("Number of predecessors in the graph: " + s.size());
+            log.debug("Number of predecessors in the graph: " + s.size());
             try {
-				Iterator<LogicalOperator> iter = s.iterator();
+                Iterator<LogicalOperator> iter = s.iterator();
                 LogicalOperator op = iter.next();
                 if (null == op) {
                     log.debug("getSchema: Operator not in plan");
                     throw new FrontendException("Could not find operator in plan");
                 }
                 mSchema = op.getSchema();
-				log.debug("Printing aliases");
-				mSchema.printAliases();
-				while(iter.hasNext()) {
-                	op = iter.next();
-					if(null == mSchema) {
-						log.debug("Schema is null, cannot perform schema merge");
-						throw new FrontendException("Schema is null, cannot perform schema merge");
-					}
-					mSchema = mSchema.merge(op.getSchema(), false);
-				}
-				mIsSchemaComputed = true;
+                log.debug("Printing aliases");
+                mSchema.printAliases();
+                while(iter.hasNext()) {
+                    op = iter.next();
+                    if(null == mSchema) {
+                        log.debug("Schema is null, cannot perform schema merge");
+                        throw new FrontendException("Schema is null, cannot perform schema merge");
+                    }
+                    mSchema = mSchema.merge(op.getSchema(), false);
+                }
+                mIsSchemaComputed = true;
             } catch (FrontendException fe) {
                 mSchema = null;
                 mIsSchemaComputed = false;

Modified: incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOUserFunc.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOUserFunc.java?rev=656043&r1=656042&r2=656043&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOUserFunc.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOUserFunc.java Tue May 13 15:52:02 2008
@@ -76,7 +76,7 @@
     public Schema.FieldSchema getFieldSchema() {
         if (!mIsFieldSchemaComputed && (mFieldSchema == null)) {
             mFieldSchema = new Schema.FieldSchema(null, mType);
-			mIsFieldSchemaComputed = true;
+            mIsFieldSchemaComputed = true;
         }
         return mFieldSchema;
     }

Modified: incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOVisitor.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOVisitor.java?rev=656043&r1=656042&r2=656043&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOVisitor.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOVisitor.java Tue May 13 15:52:02 2008
@@ -118,16 +118,16 @@
         // Visit each of the inputs of cogroup.
         MultiMap<LogicalOperator, LogicalPlan> mapGByPlans = cg.getGroupByPlans();
         for(LogicalOperator op: cg.getInputs()) {
-			for(LogicalPlan lp: mapGByPlans.get(op)) {
-	            if (null != lp) {
-					PlanWalker w = new DependencyOrderWalker(lp);
-					pushWalker(w);
-					for(LogicalOperator logicalOp: lp.getRoots()) {
-						logicalOp.visit(this);
-					}
-					popWalker();
-	            }
-			}
+            for(LogicalPlan lp: mapGByPlans.get(op)) {
+                if (null != lp) {
+                    PlanWalker w = new DependencyOrderWalker(lp);
+                    pushWalker(w);
+                    for(LogicalOperator logicalOp: lp.getRoots()) {
+                        logicalOp.visit(this);
+                    }
+                    popWalker();
+                }
+            }
         }
     }
 
@@ -139,14 +139,14 @@
      */
     protected void visit(LOGenerate g) throws VisitorException {
         // Visit each of generates projection elements.
-		for(LogicalPlan lp: g.getGeneratePlans()) {
-			PlanWalker w = new DependencyOrderWalker(lp);
-			pushWalker(w);
-			for(LogicalOperator logicalOp: lp.getRoots()) {
-				logicalOp.visit(this);
-			}
-			popWalker();
-		}
+        for(LogicalPlan lp: g.getGeneratePlans()) {
+            PlanWalker w = new DependencyOrderWalker(lp);
+            pushWalker(w);
+            for(LogicalOperator logicalOp: lp.getRoots()) {
+                logicalOp.visit(this);
+            }
+            popWalker();
+        }
     }
 
     /**
@@ -157,14 +157,14 @@
      */
     protected void visit(LOSort s) throws VisitorException {
         // Visit the sort function
-		for(LogicalPlan lp: s.getSortColPlans()) {
-			PlanWalker w = new DependencyOrderWalker(lp);
-			pushWalker(w);
-			for(LogicalOperator logicalOp: lp.getRoots()) {
-				logicalOp.visit(this);
-			}
-			popWalker();
-		}
+        for(LogicalPlan lp: s.getSortColPlans()) {
+            PlanWalker w = new DependencyOrderWalker(lp);
+            pushWalker(w);
+            for(LogicalOperator logicalOp: lp.getRoots()) {
+                logicalOp.visit(this);
+            }
+            popWalker();
+        }
     }
 
     /**
@@ -175,12 +175,12 @@
      */
     protected void visit(LOFilter filter) throws VisitorException {
         // Visit the condition for the filter followed by the input
-		PlanWalker w = new DependencyOrderWalker(filter.getComparisonPlan());
-		pushWalker(w);
-		for(LogicalOperator logicalOp: filter.getComparisonPlan().getRoots()) {
-			logicalOp.visit(this);
-		}
-		popWalker();
+        PlanWalker w = new DependencyOrderWalker(filter.getComparisonPlan());
+        pushWalker(w);
+        for(LogicalOperator logicalOp: filter.getComparisonPlan().getRoots()) {
+            logicalOp.visit(this);
+        }
+        popWalker();
     }
 
     /**
@@ -191,16 +191,16 @@
      */
     protected void visit(LOSplit split) throws VisitorException {
         // Visit each of split's conditions
-		for(LogicalPlan lp: split.getConditionPlans()) {
+        for(LogicalPlan lp: split.getConditionPlans()) {
             if (null != lp) {
-				PlanWalker w = new DependencyOrderWalker(lp);
-				pushWalker(w);
-				for(LogicalOperator logicalOp: lp.getRoots()) {
-					logicalOp.visit(this);
-				}
-				popWalker();
+                PlanWalker w = new DependencyOrderWalker(lp);
+                pushWalker(w);
+                for(LogicalOperator logicalOp: lp.getRoots()) {
+                    logicalOp.visit(this);
+                }
+                popWalker();
             }
-		}
+        }
     }
 
     /**
@@ -211,13 +211,13 @@
      */
     protected void visit(LOForEach forEach) throws VisitorException {
         // Visit the operators that are part of the foreach plan
-		LogicalPlan plan = forEach.getForEachPlan();
-		PlanWalker w = new DependencyOrderWalker(plan);
-		pushWalker(w);
-		for(LogicalOperator logicalOp: plan.getRoots()) {
-			logicalOp.visit(this);
-		}
-		popWalker();
+        LogicalPlan plan = forEach.getForEachPlan();
+        PlanWalker w = new DependencyOrderWalker(plan);
+        pushWalker(w);
+        for(LogicalOperator logicalOp: plan.getRoots()) {
+            logicalOp.visit(this);
+        }
+        popWalker();
     }
 
     /**
@@ -289,10 +289,10 @@
 
     protected void visit(LOProject project) throws VisitorException {
         // Visit the operand of the project as long as the sentinel is false
-		
-		if(!project.getSentinel()) {
-			project.getExpression().visit(this);
-		}
+        
+        if(!project.getSentinel()) {
+            project.getExpression().visit(this);
+        }
     }
 
 }

Modified: incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LogicalOperator.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LogicalOperator.java?rev=656043&r1=656042&r2=656043&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LogicalOperator.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LogicalOperator.java Tue May 13 15:52:02 2008
@@ -215,7 +215,7 @@
      */
     public abstract void visit(LOVisitor v) throws VisitorException;
 
-	/*
+    /*
     public boolean isFlatten() {
         return mIsFlatten;
     }
@@ -223,6 +223,6 @@
     public void setFlatten(boolean b) {
         mIsFlatten = b;
     }
-	*/
+    */
 
 }

Modified: incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/validators/TypeCheckingVisitor.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/validators/TypeCheckingVisitor.java?rev=656043&r1=656042&r2=656043&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/validators/TypeCheckingVisitor.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/validators/TypeCheckingVisitor.java Tue May 13 15:52:02 2008
@@ -831,8 +831,8 @@
     */
 
     // TODO: NOT DONE YET
-	//COmmenting out this method as its not using the new APIs
-	/*
+    //COmmenting out this method as its not using the new APIs
+    /*
     protected void visit(LOGenerate g) throws VisitorException {
         // Visit each of generates projection elements.
         Iterator<ExpressionOperator> i = g.getProjections().iterator();
@@ -840,7 +840,7 @@
             i.next().visit(this);
         }
     }
-	*/
+    */
     
     /***
      * This does:-

Modified: incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/plans/ExprPlanVisitor.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/plans/ExprPlanVisitor.java?rev=656043&r1=656042&r2=656043&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/plans/ExprPlanVisitor.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/plans/ExprPlanVisitor.java Tue May 13 15:52:02 2008
@@ -108,14 +108,14 @@
         //do nothing
     }
 
-	public void visitBinCond(POBinCond binCond) {
-		// do nothing
-		
-	}
+    public void visitBinCond(POBinCond binCond) {
+        // do nothing
+        
+    }
 
-	public void visitNegative(PONegative negative) {
-		//do nothing
-		
-	}
+    public void visitNegative(PONegative negative) {
+        //do nothing
+        
+    }
 
 }

Modified: incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/plans/PhyPlanVisitor.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/plans/PhyPlanVisitor.java?rev=656043&r1=656042&r2=656043&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/plans/PhyPlanVisitor.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/plans/PhyPlanVisitor.java Tue May 13 15:52:02 2008
@@ -116,24 +116,24 @@
         //do nothing
     }
 
-	public void visitDistinct(PODistinct distinct) throws VisitorException {
-        //do nothing		
-	}
+    public void visitDistinct(PODistinct distinct) throws VisitorException {
+        //do nothing        
+    }
 
-	public void visitRead(PORead read) throws VisitorException {
-        //do nothing		
-	}
+    public void visitRead(PORead read) throws VisitorException {
+        //do nothing        
+    }
 
-	public void visitSort(POSort sort) throws VisitorException {
+    public void visitSort(POSort sort) throws VisitorException {
         List<ExprPlan> inpPlans = sort.getSortPlans();
         for (ExprPlan plan : inpPlans) {
             ExprPlanVisitor epv = new ExprPlanVisitor(plan,new DependencyOrderWalker<ExpressionOperator, ExprPlan>(plan));
             epv.visit();
         }
-	}
+    }
 
-	public void visitUserFunc(POUserFunc userFunc) throws VisitorException {
-	    //do nothing
-	}
+    public void visitUserFunc(POUserFunc userFunc) throws VisitorException {
+        //do nothing
+    }
 
 }

Modified: incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/PODistinct.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/PODistinct.java?rev=656043&r1=656042&r2=656043&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/PODistinct.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/PODistinct.java Tue May 13 15:52:02 2008
@@ -41,87 +41,87 @@
  */
 public class PODistinct extends PhysicalOperator<PhyPlanVisitor> {
 
-	private boolean inputsAccumulated = false;
-	private DataBag distinctBag = BagFactory.getInstance().newDistinctBag();
-	private final Log log = LogFactory.getLog(getClass());
-	transient Iterator<Tuple> it;
-
-	public PODistinct(OperatorKey k, int rp, List<PhysicalOperator> inp) {
-		super(k, rp, inp);
-		// TODO Auto-generated constructor stub
-	}
-
-	public PODistinct(OperatorKey k, int rp) {
-		super(k, rp);
-		// TODO Auto-generated constructor stub
-	}
-
-	public PODistinct(OperatorKey k, List<PhysicalOperator> inp) {
-		super(k, inp);
-		// TODO Auto-generated constructor stub
-	}
-
-	public PODistinct(OperatorKey k) {
-		super(k);
-		// TODO Auto-generated constructor stub
-	}
-
-	@Override
-	public boolean isBlocking() {
-		// TODO Auto-generated method stub
-		return true;
-	}
-
-	@Override
-	public Result getNext(Tuple t) throws ExecException {
-		if (!inputsAccumulated) {
-			Result in = processInput();
-			while (in.returnStatus != POStatus.STATUS_EOP) {
-				if (in.returnStatus == POStatus.STATUS_ERR) {
-					log.error("Error in reading from inputs");
-					continue;
-				} else if (in.returnStatus == POStatus.STATUS_NULL) {
-					continue;
-				}
-				distinctBag.add((Tuple) in.result);
-				in = processInput();
-			}
-			inputsAccumulated = true;
-		}
-		if (it == null) {
-			it = distinctBag.iterator();
-		}
-		res.result = it.next();
-		if (res.result == null)
-			res.returnStatus = POStatus.STATUS_EOP;
-		else
-			res.returnStatus = POStatus.STATUS_OK;
-		return res;
-
-	}
-
-	@Override
-	public String name() {
-		// TODO Auto-generated method stub
-		return "PODistinct - " + mKey.toString();
-	}
-
-	@Override
-	public boolean supportsMultipleInputs() {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	@Override
-	public boolean supportsMultipleOutputs() {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	@Override
-	public void visit(PhyPlanVisitor v) throws VisitorException {
-		// TODO Auto-generated method stub
-		v.visitDistinct(this);
-	}
+    private boolean inputsAccumulated = false;
+    private DataBag distinctBag = BagFactory.getInstance().newDistinctBag();
+    private final Log log = LogFactory.getLog(getClass());
+    transient Iterator<Tuple> it;
+
+    public PODistinct(OperatorKey k, int rp, List<PhysicalOperator> inp) {
+        super(k, rp, inp);
+        // TODO Auto-generated constructor stub
+    }
+
+    public PODistinct(OperatorKey k, int rp) {
+        super(k, rp);
+        // TODO Auto-generated constructor stub
+    }
+
+    public PODistinct(OperatorKey k, List<PhysicalOperator> inp) {
+        super(k, inp);
+        // TODO Auto-generated constructor stub
+    }
+
+    public PODistinct(OperatorKey k) {
+        super(k);
+        // TODO Auto-generated constructor stub
+    }
+
+    @Override
+    public boolean isBlocking() {
+        // TODO Auto-generated method stub
+        return true;
+    }
+
+    @Override
+    public Result getNext(Tuple t) throws ExecException {
+        if (!inputsAccumulated) {
+            Result in = processInput();
+            while (in.returnStatus != POStatus.STATUS_EOP) {
+                if (in.returnStatus == POStatus.STATUS_ERR) {
+                    log.error("Error in reading from inputs");
+                    continue;
+                } else if (in.returnStatus == POStatus.STATUS_NULL) {
+                    continue;
+                }
+                distinctBag.add((Tuple) in.result);
+                in = processInput();
+            }
+            inputsAccumulated = true;
+        }
+        if (it == null) {
+            it = distinctBag.iterator();
+        }
+        res.result = it.next();
+        if (res.result == null)
+            res.returnStatus = POStatus.STATUS_EOP;
+        else
+            res.returnStatus = POStatus.STATUS_OK;
+        return res;
+
+    }
+
+    @Override
+    public String name() {
+        // TODO Auto-generated method stub
+        return "PODistinct - " + mKey.toString();
+    }
+
+    @Override
+    public boolean supportsMultipleInputs() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsMultipleOutputs() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public void visit(PhyPlanVisitor v) throws VisitorException {
+        // TODO Auto-generated method stub
+        v.visitDistinct(this);
+    }
 
 }

Modified: incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/PORead.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/PORead.java?rev=656043&r1=656042&r2=656043&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/PORead.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/PORead.java Tue May 13 15:52:02 2008
@@ -35,71 +35,71 @@
  */
 public class PORead extends PhysicalOperator<PhyPlanVisitor> {
 
-	DataBag bag;
-	transient Iterator<Tuple> it;
+    DataBag bag;
+    transient Iterator<Tuple> it;
 
-	public PORead(OperatorKey k) {
-		super(k);
-		// TODO Auto-generated constructor stub
-	}
-
-	public PORead(OperatorKey k, int rp, List<PhysicalOperator> inp) {
-		super(k, rp, inp);
-		// TODO Auto-generated constructor stub
-	}
-
-	public PORead(OperatorKey k, int rp) {
-		super(k, rp);
-		// TODO Auto-generated constructor stub
-	}
-
-	public PORead(OperatorKey k, List<PhysicalOperator> inp) {
-		super(k, inp);
-		// TODO Auto-generated constructor stub
-	}
-
-	public PORead(OperatorKey k, DataBag bag) {
-		super(k);
-		this.bag = bag;
-	}
-
-	@Override
-	public Result getNext(Tuple t) {
-		if (it == null) {
-			it = bag.iterator();
-		}
-		Result res = new Result();
-		if (it.hasNext()) {
-			res.returnStatus = POStatus.STATUS_OK;
-			res.result = it.next();
-		} else {
-			res.returnStatus = POStatus.STATUS_EOP;
-		}
-		return res;
-	}
-
-	@Override
-	public String name() {
-		// TODO Auto-generated method stub
-		return "PORead - " + mKey.toString();
-	}
-
-	@Override
-	public boolean supportsMultipleInputs() {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	@Override
-	public boolean supportsMultipleOutputs() {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	@Override
-	public void visit(PhyPlanVisitor v) throws VisitorException {
-		// TODO Auto-generated method stub
-		v.visitRead(this);
-	}
+    public PORead(OperatorKey k) {
+        super(k);
+        // TODO Auto-generated constructor stub
+    }
+
+    public PORead(OperatorKey k, int rp, List<PhysicalOperator> inp) {
+        super(k, rp, inp);
+        // TODO Auto-generated constructor stub
+    }
+
+    public PORead(OperatorKey k, int rp) {
+        super(k, rp);
+        // TODO Auto-generated constructor stub
+    }
+
+    public PORead(OperatorKey k, List<PhysicalOperator> inp) {
+        super(k, inp);
+        // TODO Auto-generated constructor stub
+    }
+
+    public PORead(OperatorKey k, DataBag bag) {
+        super(k);
+        this.bag = bag;
+    }
+
+    @Override
+    public Result getNext(Tuple t) {
+        if (it == null) {
+            it = bag.iterator();
+        }
+        Result res = new Result();
+        if (it.hasNext()) {
+            res.returnStatus = POStatus.STATUS_OK;
+            res.result = it.next();
+        } else {
+            res.returnStatus = POStatus.STATUS_EOP;
+        }
+        return res;
+    }
+
+    @Override
+    public String name() {
+        // TODO Auto-generated method stub
+        return "PORead - " + mKey.toString();
+    }
+
+    @Override
+    public boolean supportsMultipleInputs() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsMultipleOutputs() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public void visit(PhyPlanVisitor v) throws VisitorException {
+        // TODO Auto-generated method stub
+        v.visitRead(this);
+    }
 
 }

Modified: incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/POSort.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/POSort.java?rev=656043&r1=656042&r2=656043&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/POSort.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/POSort.java Tue May 13 15:52:02 2008
@@ -51,94 +51,94 @@
  */
 public class POSort extends PhysicalOperator<PhyPlanVisitor> {
 
-	//private List<Integer> mSortCols;
-	private List<ExprPlan> sortPlans;
-	private List<Byte> ExprOutputTypes;
-	private List<Boolean> mAscCols;
-	private POUserComparisonFunc mSortFunc;
-	private final Log log = LogFactory.getLog(getClass());
-
-	private boolean inputsAccumulated = false;
-	public boolean isUDFComparatorUsed = false;
-	private DataBag sortedBag;
-	transient Iterator<Tuple> it;
-
-	public POSort(OperatorKey k, int rp, List inp, List<ExprPlan> sortPlans,
-			List<Boolean> mAscCols, POUserFunc mSortFunc) {
-		super(k, rp, inp);
-		//this.mSortCols = mSortCols;
-		this.sortPlans = sortPlans;
-		this.mAscCols = mAscCols;
-		this.mSortFunc = (POUserComparisonFunc) mSortFunc;
-		if (mSortFunc == null) {
-			sortedBag = BagFactory.getInstance().newSortedBag(
-					new SortComparator());
-			ExprOutputTypes = new ArrayList<Byte>(sortPlans.size());
-
-			for(ExprPlan plan : sortPlans) {
-				ExprOutputTypes.add(plan.getLeaves().get(0).resultType);
-			}
-		} else {
-			sortedBag = BagFactory.getInstance().newSortedBag(
-					new UDFSortComparator());
-			isUDFComparatorUsed = true;
-		}
-	}
-
-	public POSort(OperatorKey k, int rp, List inp) {
-		super(k, rp, inp);
-
-	}
-
-	public POSort(OperatorKey k, int rp) {
-		super(k, rp);
-
-	}
-
-	public POSort(OperatorKey k, List inp) {
-		super(k, inp);
-
-	}
-
-	public POSort(OperatorKey k) {
-		super(k);
-
-	}
-	
-	public class SortComparator implements Comparator<Tuple> {
-		public int compare(Tuple o1, Tuple o2) {
-			int count = 0;
-			int ret = 0;
-			if(sortPlans == null || sortPlans.size() == 0) 
-				return 0;
-			for(ExprPlan plan : sortPlans) {
-				try {
-					plan.attachInput(o1);
-					Result res1 = getResult(plan, ExprOutputTypes.get(count));
-					plan.attachInput(o2);
-					Result res2 = getResult(plan, ExprOutputTypes.get(count));
-					if(res1.returnStatus != POStatus.STATUS_OK || res2.returnStatus != POStatus.STATUS_OK) {
-						log.error("Error processing the input in the expression plan : " + plan.toString());
-					} else {
-						if(mAscCols.get(count ++))
-							ret = DataType.compare(res1.result, res2.result);
-						else
-							ret = DataType.compare(res2.result, res1.result);
-					}
-						
-				} catch (ExecException e) {
-					log.error("Invalid result while executing the expression plan : " + plan.toString() + "\n" + e.getMessage());
-				}
-				
-			}
-			return ret;
-		} 
-		
-		private Result getResult(ExprPlan plan, byte resultType) throws ExecException {
-			ExpressionOperator Op = plan.getLeaves().get(0);
-			Result res = null;
-			
-			switch (resultType) {
+    //private List<Integer> mSortCols;
+    private List<ExprPlan> sortPlans;
+    private List<Byte> ExprOutputTypes;
+    private List<Boolean> mAscCols;
+    private POUserComparisonFunc mSortFunc;
+    private final Log log = LogFactory.getLog(getClass());
+
+    private boolean inputsAccumulated = false;
+    public boolean isUDFComparatorUsed = false;
+    private DataBag sortedBag;
+    transient Iterator<Tuple> it;
+
+    public POSort(OperatorKey k, int rp, List inp, List<ExprPlan> sortPlans,
+            List<Boolean> mAscCols, POUserFunc mSortFunc) {
+        super(k, rp, inp);
+        //this.mSortCols = mSortCols;
+        this.sortPlans = sortPlans;
+        this.mAscCols = mAscCols;
+        this.mSortFunc = (POUserComparisonFunc) mSortFunc;
+        if (mSortFunc == null) {
+            sortedBag = BagFactory.getInstance().newSortedBag(
+                    new SortComparator());
+            ExprOutputTypes = new ArrayList<Byte>(sortPlans.size());
+
+            for(ExprPlan plan : sortPlans) {
+                ExprOutputTypes.add(plan.getLeaves().get(0).resultType);
+            }
+        } else {
+            sortedBag = BagFactory.getInstance().newSortedBag(
+                    new UDFSortComparator());
+            isUDFComparatorUsed = true;
+        }
+    }
+
+    public POSort(OperatorKey k, int rp, List inp) {
+        super(k, rp, inp);
+
+    }
+
+    public POSort(OperatorKey k, int rp) {
+        super(k, rp);
+
+    }
+
+    public POSort(OperatorKey k, List inp) {
+        super(k, inp);
+
+    }
+
+    public POSort(OperatorKey k) {
+        super(k);
+
+    }
+    
+    public class SortComparator implements Comparator<Tuple> {
+        public int compare(Tuple o1, Tuple o2) {
+            int count = 0;
+            int ret = 0;
+            if(sortPlans == null || sortPlans.size() == 0) 
+                return 0;
+            for(ExprPlan plan : sortPlans) {
+                try {
+                    plan.attachInput(o1);
+                    Result res1 = getResult(plan, ExprOutputTypes.get(count));
+                    plan.attachInput(o2);
+                    Result res2 = getResult(plan, ExprOutputTypes.get(count));
+                    if(res1.returnStatus != POStatus.STATUS_OK || res2.returnStatus != POStatus.STATUS_OK) {
+                        log.error("Error processing the input in the expression plan : " + plan.toString());
+                    } else {
+                        if(mAscCols.get(count ++))
+                            ret = DataType.compare(res1.result, res2.result);
+                        else
+                            ret = DataType.compare(res2.result, res1.result);
+                    }
+                        
+                } catch (ExecException e) {
+                    log.error("Invalid result while executing the expression plan : " + plan.toString() + "\n" + e.getMessage());
+                }
+                
+            }
+            return ret;
+        } 
+        
+        private Result getResult(ExprPlan plan, byte resultType) throws ExecException {
+            ExpressionOperator Op = plan.getLeaves().get(0);
+            Result res = null;
+            
+            switch (resultType) {
             case DataType.BYTEARRAY:
                 res = Op.getNext(dummyDBA);
                 break;
@@ -158,92 +158,92 @@
                 res = Op.getNext(dummyLong);
                 break;
             }
-			return res;
-		}
-	}
-
-	public class UDFSortComparator implements Comparator<Tuple> {
-
-		public int compare(Tuple t1, Tuple t2) {
-
-			mSortFunc.attachInput(t1, t2);
-			Integer i = null;
-			Result res = null;
-			try {
-				res = mSortFunc.getNext(i);
-			} catch (ExecException e) {
-
-				log.error("Input not ready. Error on reading from input. "
-						+ e.getMessage());
-			}
-			if (res != null)
-				return (Integer) res.result;
-			else
-				return 0;
-		}
-
-	}
-
-	@Override
-	public String name() {
-
-		return "POSort - " + mKey.toString();
-	}
-
-	@Override
-	public boolean isBlocking() {
-
-		return true;
-	}
-
-	@Override
-	public Result getNext(Tuple t) throws ExecException {
-		Result res = new Result();
-		if (!inputsAccumulated) {
-			res = processInput();
-			while (res.returnStatus != POStatus.STATUS_EOP) {
-				if (res.returnStatus == POStatus.STATUS_ERR) {
-					log.error("Error in reading from the inputs");
-					continue;
-				} else if (res.returnStatus == POStatus.STATUS_NULL) {
-					continue;
-				}
-				sortedBag.add((Tuple) res.result);
-				res = processInput();
-
-			}
-
-			inputsAccumulated = true;
-
-		}
-		if (it == null) {
-			it = sortedBag.iterator();
-		}
-		res.result = it.next();
-		if (res.result == null)
-			res.returnStatus = POStatus.STATUS_EOP;
-		else
-			res.returnStatus = POStatus.STATUS_OK;
-		return res;
-	}
-
-	@Override
-	public boolean supportsMultipleInputs() {
-
-		return false;
-	}
-
-	@Override
-	public boolean supportsMultipleOutputs() {
+            return res;
+        }
+    }
+
+    public class UDFSortComparator implements Comparator<Tuple> {
+
+        public int compare(Tuple t1, Tuple t2) {
+
+            mSortFunc.attachInput(t1, t2);
+            Integer i = null;
+            Result res = null;
+            try {
+                res = mSortFunc.getNext(i);
+            } catch (ExecException e) {
+
+                log.error("Input not ready. Error on reading from input. "
+                        + e.getMessage());
+            }
+            if (res != null)
+                return (Integer) res.result;
+            else
+                return 0;
+        }
+
+    }
+
+    @Override
+    public String name() {
+
+        return "POSort - " + mKey.toString();
+    }
 
-		return false;
-	}
+    @Override
+    public boolean isBlocking() {
+
+        return true;
+    }
+
+    @Override
+    public Result getNext(Tuple t) throws ExecException {
+        Result res = new Result();
+        if (!inputsAccumulated) {
+            res = processInput();
+            while (res.returnStatus != POStatus.STATUS_EOP) {
+                if (res.returnStatus == POStatus.STATUS_ERR) {
+                    log.error("Error in reading from the inputs");
+                    continue;
+                } else if (res.returnStatus == POStatus.STATUS_NULL) {
+                    continue;
+                }
+                sortedBag.add((Tuple) res.result);
+                res = processInput();
+
+            }
 
-	@Override
-	public void visit(PhyPlanVisitor v) throws VisitorException {
+            inputsAccumulated = true;
 
-		v.visitSort(this);
-	}
+        }
+        if (it == null) {
+            it = sortedBag.iterator();
+        }
+        res.result = it.next();
+        if (res.result == null)
+            res.returnStatus = POStatus.STATUS_EOP;
+        else
+            res.returnStatus = POStatus.STATUS_OK;
+        return res;
+    }
+
+    @Override
+    public boolean supportsMultipleInputs() {
+
+        return false;
+    }
+
+    @Override
+    public boolean supportsMultipleOutputs() {
+
+        return false;
+    }
+
+    @Override
+    public void visit(PhyPlanVisitor v) throws VisitorException {
+
+        v.visitSort(this);
+    }
 
     public List<ExprPlan> getSortPlans() {
         return sortPlans;

Modified: incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/POUserComparisonFunc.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/POUserComparisonFunc.java?rev=656043&r1=656042&r2=656043&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/POUserComparisonFunc.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/POUserComparisonFunc.java Tue May 13 15:52:02 2008
@@ -17,108 +17,108 @@
 
 public class POUserComparisonFunc extends POUserFunc {
 
-	transient ComparisonFunc func;
-	private Log log = LogFactory.getLog(getClass());
-	
-	public POUserComparisonFunc(OperatorKey k, int rp, List inp, String funcSpec, ComparisonFunc func) {
-		super(k, rp, inp);
-		this.funcSpec = funcSpec;
-		this.func = func;		
-	}
-	
-	public POUserComparisonFunc(OperatorKey k, int rp, List inp, String funcSpec) {
-		this(k, rp, inp, funcSpec, null);
-		
-		instantiateFunc();
-	}
-	
-	private void instantiateFunc() {
-		this.func = (ComparisonFunc) PigContext.instantiateFuncFromSpec(this.funcSpec);
-	}
-	
-	public ComparisonFunc getComparator() {
-		if (func == null)
-			instantiateFunc();
-		return func;
-	}
-	
-	@Override
-	public Result getNext(Integer i) throws ExecException {
-		Result result = new Result();
-
-		if (func == null)
-			instantiateFunc();
-
-
-		result.result = func.compare(t1, t2);
-		result.returnStatus = (t1 != null && t2 != null) ? POStatus.STATUS_OK
-				: POStatus.STATUS_ERR;
-		// the two attached tuples are used up now. So we set the
-		// inputAttached flag to false
-		inputAttached = false;
-		return result;
-
-	}
-	
-	private Result getNext() {
-		Result res = null;
-		log.error("getNext being called with non-integer");
-		return res;
-	}
-	
-	@Override
-	public Result getNext(Boolean b) throws ExecException {
-		return getNext();
-	}
-
-	@Override
-	public Result getNext(DataBag db) throws ExecException {
-		return getNext();
-	}
-
-	@Override
-	public Result getNext(DataByteArray ba) throws ExecException {
-		return getNext();
-	}
-
-	@Override
-	public Result getNext(Double d) throws ExecException {
-		return getNext();
-	}
-
-	@Override
-	public Result getNext(Float f) throws ExecException {
-		return getNext();
-	}
-
-	@Override
-	public Result getNext(Long l) throws ExecException {
-		return getNext();
-	}
-
-	@Override
-	public Result getNext(Map m) throws ExecException {
-		return getNext();
-	}
-
-	@Override
-	public Result getNext(String s) throws ExecException {
-		return getNext();
-	}
-
-	@Override
-	public Result getNext(Tuple in) throws ExecException {
-		return getNext();
-	}
-
-	public void attachInput(Tuple t1, Tuple t2) {
-		if (func == null)
-			instantiateFunc();
-
-		this.t1 = t1;
-		this.t2 = t2;
-		inputAttached = true;
+    transient ComparisonFunc func;
+    private Log log = LogFactory.getLog(getClass());
+    
+    public POUserComparisonFunc(OperatorKey k, int rp, List inp, String funcSpec, ComparisonFunc func) {
+        super(k, rp, inp);
+        this.funcSpec = funcSpec;
+        this.func = func;        
+    }
+    
+    public POUserComparisonFunc(OperatorKey k, int rp, List inp, String funcSpec) {
+        this(k, rp, inp, funcSpec, null);
+        
+        instantiateFunc();
+    }
+    
+    private void instantiateFunc() {
+        this.func = (ComparisonFunc) PigContext.instantiateFuncFromSpec(this.funcSpec);
+    }
+    
+    public ComparisonFunc getComparator() {
+        if (func == null)
+            instantiateFunc();
+        return func;
+    }
+    
+    @Override
+    public Result getNext(Integer i) throws ExecException {
+        Result result = new Result();
+
+        if (func == null)
+            instantiateFunc();
+
+
+        result.result = func.compare(t1, t2);
+        result.returnStatus = (t1 != null && t2 != null) ? POStatus.STATUS_OK
+                : POStatus.STATUS_ERR;
+        // the two attached tuples are used up now. So we set the
+        // inputAttached flag to false
+        inputAttached = false;
+        return result;
+
+    }
+    
+    private Result getNext() {
+        Result res = null;
+        log.error("getNext being called with non-integer");
+        return res;
+    }
+    
+    @Override
+    public Result getNext(Boolean b) throws ExecException {
+        return getNext();
+    }
+
+    @Override
+    public Result getNext(DataBag db) throws ExecException {
+        return getNext();
+    }
+
+    @Override
+    public Result getNext(DataByteArray ba) throws ExecException {
+        return getNext();
+    }
+
+    @Override
+    public Result getNext(Double d) throws ExecException {
+        return getNext();
+    }
+
+    @Override
+    public Result getNext(Float f) throws ExecException {
+        return getNext();
+    }
+
+    @Override
+    public Result getNext(Long l) throws ExecException {
+        return getNext();
+    }
+
+    @Override
+    public Result getNext(Map m) throws ExecException {
+        return getNext();
+    }
+
+    @Override
+    public Result getNext(String s) throws ExecException {
+        return getNext();
+    }
+
+    @Override
+    public Result getNext(Tuple in) throws ExecException {
+        return getNext();
+    }
+
+    public void attachInput(Tuple t1, Tuple t2) {
+        if (func == null)
+            instantiateFunc();
+
+        this.t1 = t1;
+        this.t2 = t2;
+        inputAttached = true;
 
-	}
+    }
 
 }

Modified: incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/POUserFunc.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/POUserFunc.java?rev=656043&r1=656042&r2=656043&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/POUserFunc.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/POUserFunc.java Tue May 13 15:52:02 2008
@@ -42,242 +42,242 @@
 
 public class POUserFunc extends PhysicalOperator<PhyPlanVisitor> {
 
-	transient EvalFunc func;
-	Tuple t1, t2;
-	private final Log log = LogFactory.getLog(getClass());
-	String funcSpec;
-	private final byte INITIAL = 0;
-	private final byte INTERMEDIATE = 1;
-	private final byte FINAL = 2;
-
-	public POUserFunc(OperatorKey k, int rp, List inp) {
-		super(k, rp);
-		inputs = inp;
-
-	}
-
-	public POUserFunc(OperatorKey k, int rp, List inp, String funcSpec) {
-		this(k, rp, inp, funcSpec, null);
-
-		instantiateFunc();
-	}
-	
-	public POUserFunc(OperatorKey k, int rp, List inp, String funcSpec, EvalFunc func) {
-		super(k, rp, inp);
-		this.funcSpec = funcSpec;
-		this.func = func;
-
-	}
-
-	private void instantiateFunc() {
-		this.func = (EvalFunc) PigContext.instantiateFuncFromSpec(this.funcSpec);
-	}
-
-	private Result getNext() throws ExecException {
-		Tuple t = null;
-		Result result = new Result();
-		// instantiate the function if its null
-		if (func == null)
-			instantiateFunc();
-
-		try {
-			if (inputAttached) {
-				result.result = func.exec(input);
-				result.returnStatus = (result.result != null) ? POStatus.STATUS_OK
-						: POStatus.STATUS_EOP;
-				return result;
-			} else {
-				Result in = inputs.get(0).getNext(t);
-				if (in.returnStatus == POStatus.STATUS_EOP) {
-					result.returnStatus = POStatus.STATUS_EOP;
-					return result;
-				}
-				result.result = func.exec((Tuple) in.result);
-				result.returnStatus = POStatus.STATUS_OK;
-				return result;
-			}
-		} catch (IOException e) {
-			log.error(e);
-			//throw new ExecException(e.getCause());
-		}
-		result.returnStatus = POStatus.STATUS_ERR;
-		return result;
-	}
-
-	@Override
-	public Result getNext(Tuple tIn) throws ExecException {
-		return getNext();
-	}
-
-	@Override
-	public Result getNext(DataBag db) throws ExecException {
-		return getNext();
-	}
-
-	@Override
-	public Result getNext(Integer i) throws ExecException {
-		return getNext();
-	}
-
-	@Override
-	public Result getNext(Boolean b) throws ExecException {
-
-		return getNext();
-	}
-
-	@Override
-	public Result getNext(DataByteArray ba) throws ExecException {
-
-		return getNext();
-	}
-
-	@Override
-	public Result getNext(Double d) throws ExecException {
-
-		return getNext();
-	}
-
-	@Override
-	public Result getNext(Float f) throws ExecException {
-
-		return getNext();
-	}
-
-	@Override
-	public Result getNext(Long l) throws ExecException {
-
-		return getNext();
-	}
-
-	@Override
-	public Result getNext(Map m) throws ExecException {
-
-		return getNext();
-	}
-
-	@Override
-	public Result getNext(String s) throws ExecException {
-
-		return getNext();
-	}
-
-	public void setAlgebraicFunction(Byte Function) {
-		// This will only be used by the optimizer for putting correct functions
-		// in the mapper,
-		// combiner and reduce. This helps in maintaining the physical plan as
-		// is without the
-		// optimiser having to replace any operators.
-		// You wouldn't be able to make two calls to this function on the same
-		// algebraic EvalFunc as
-		// func is being changed.
-		switch (Function) {
-		case INITIAL:
-			func = (EvalFunc) PigContext.instantiateFuncFromSpec(getInitial());
-			setResultType(DataType.findType(((EvalFunc) func).getReturnType()));
-			break;
-		case INTERMEDIATE:
-			func = (EvalFunc) PigContext.instantiateFuncFromSpec(getIntermed());
-			setResultType(DataType.findType(((EvalFunc) func).getReturnType()));
-			break;
-		case FINAL:
-			func = (EvalFunc) PigContext.instantiateFuncFromSpec(getFinal());
-			setResultType(DataType.findType(((EvalFunc) func).getReturnType()));
-			break;
-
-		}
-	}
-
-	public String getInitial() {
-		if (func == null)
-			instantiateFunc();
-
-		if (func instanceof Algebraic) {
-			return ((Algebraic) func).getInitial();
-		} else {
-			log
-					.error("Attempt to run a non-algebraic function as an algebraic function");
-		}
-		return null;
-	}
-
-	public String getIntermed() {
-		if (func == null)
-			instantiateFunc();
-
-		if (func instanceof Algebraic) {
-			return ((Algebraic) func).getIntermed();
-		} else {
-			log
-					.error("Attempt to run a non-algebraic function as an algebraic function");
-		}
-		return null;
-	}
-
-	public String getFinal() {
-		if (func == null)
-			instantiateFunc();
-
-		if (func instanceof Algebraic) {
-			return ((Algebraic) func).getFinal();
-		} else {
-			log
-					.error("Attempt to run a non-algebraic function as an algebraic function");
-		}
-		return null;
-	}
-
-	public Type getReturnType() {
-		if (func == null)
-			instantiateFunc();
-
-		return func.getReturnType();
-	}
-
-	public void finish() {
-		if (func == null)
-			instantiateFunc();
-
-		func.finish();
-	}
-
-	public Schema outputSchema(Schema input) {
-		if (func == null)
-			instantiateFunc();
-
-		return func.outputSchema(input);
-	}
-
-	public Boolean isAsynchronous() {
-		if (func == null)
-			instantiateFunc();
-		
-		return func.isAsynchronous();
-	}
-
-	@Override
-	public String name() {
-	    if(funcSpec!=null)
-	        return "POUserFunc" + "(" + funcSpec + ")" + " - " + mKey.toString();
+    transient EvalFunc func;
+    Tuple t1, t2;
+    private final Log log = LogFactory.getLog(getClass());
+    String funcSpec;
+    private final byte INITIAL = 0;
+    private final byte INTERMEDIATE = 1;
+    private final byte FINAL = 2;
+
+    public POUserFunc(OperatorKey k, int rp, List inp) {
+        super(k, rp);
+        inputs = inp;
+
+    }
+
+    public POUserFunc(OperatorKey k, int rp, List inp, String funcSpec) {
+        this(k, rp, inp, funcSpec, null);
+
+        instantiateFunc();
+    }
+    
+    public POUserFunc(OperatorKey k, int rp, List inp, String funcSpec, EvalFunc func) {
+        super(k, rp, inp);
+        this.funcSpec = funcSpec;
+        this.func = func;
+
+    }
+
+    private void instantiateFunc() {
+        this.func = (EvalFunc) PigContext.instantiateFuncFromSpec(this.funcSpec);
+    }
+
+    private Result getNext() throws ExecException {
+        Tuple t = null;
+        Result result = new Result();
+        // instantiate the function if its null
+        if (func == null)
+            instantiateFunc();
+
+        try {
+            if (inputAttached) {
+                result.result = func.exec(input);
+                result.returnStatus = (result.result != null) ? POStatus.STATUS_OK
+                        : POStatus.STATUS_EOP;
+                return result;
+            } else {
+                Result in = inputs.get(0).getNext(t);
+                if (in.returnStatus == POStatus.STATUS_EOP) {
+                    result.returnStatus = POStatus.STATUS_EOP;
+                    return result;
+                }
+                result.result = func.exec((Tuple) in.result);
+                result.returnStatus = POStatus.STATUS_OK;
+                return result;
+            }
+        } catch (IOException e) {
+            log.error(e);
+            //throw new ExecException(e.getCause());
+        }
+        result.returnStatus = POStatus.STATUS_ERR;
+        return result;
+    }
+
+    @Override
+    public Result getNext(Tuple tIn) throws ExecException {
+        return getNext();
+    }
+
+    @Override
+    public Result getNext(DataBag db) throws ExecException {
+        return getNext();
+    }
+
+    @Override
+    public Result getNext(Integer i) throws ExecException {
+        return getNext();
+    }
+
+    @Override
+    public Result getNext(Boolean b) throws ExecException {
+
+        return getNext();
+    }
+
+    @Override
+    public Result getNext(DataByteArray ba) throws ExecException {
+
+        return getNext();
+    }
+
+    @Override
+    public Result getNext(Double d) throws ExecException {
+
+        return getNext();
+    }
+
+    @Override
+    public Result getNext(Float f) throws ExecException {
+
+        return getNext();
+    }
+
+    @Override
+    public Result getNext(Long l) throws ExecException {
+
+        return getNext();
+    }
+
+    @Override
+    public Result getNext(Map m) throws ExecException {
+
+        return getNext();
+    }
+
+    @Override
+    public Result getNext(String s) throws ExecException {
+
+        return getNext();
+    }
+
+    public void setAlgebraicFunction(Byte Function) {
+        // This will only be used by the optimizer for putting correct functions
+        // in the mapper,
+        // combiner and reduce. This helps in maintaining the physical plan as
+        // is without the
+        // optimiser having to replace any operators.
+        // You wouldn't be able to make two calls to this function on the same
+        // algebraic EvalFunc as
+        // func is being changed.
+        switch (Function) {
+        case INITIAL:
+            func = (EvalFunc) PigContext.instantiateFuncFromSpec(getInitial());
+            setResultType(DataType.findType(((EvalFunc) func).getReturnType()));
+            break;
+        case INTERMEDIATE:
+            func = (EvalFunc) PigContext.instantiateFuncFromSpec(getIntermed());
+            setResultType(DataType.findType(((EvalFunc) func).getReturnType()));
+            break;
+        case FINAL:
+            func = (EvalFunc) PigContext.instantiateFuncFromSpec(getFinal());
+            setResultType(DataType.findType(((EvalFunc) func).getReturnType()));
+            break;
+
+        }
+    }
+
+    public String getInitial() {
+        if (func == null)
+            instantiateFunc();
+
+        if (func instanceof Algebraic) {
+            return ((Algebraic) func).getInitial();
+        } else {
+            log
+                    .error("Attempt to run a non-algebraic function as an algebraic function");
+        }
+        return null;
+    }
+
+    public String getIntermed() {
+        if (func == null)
+            instantiateFunc();
+
+        if (func instanceof Algebraic) {
+            return ((Algebraic) func).getIntermed();
+        } else {
+            log
+                    .error("Attempt to run a non-algebraic function as an algebraic function");
+        }
+        return null;
+    }
+
+    public String getFinal() {
+        if (func == null)
+            instantiateFunc();
+
+        if (func instanceof Algebraic) {
+            return ((Algebraic) func).getFinal();
+        } else {
+            log
+                    .error("Attempt to run a non-algebraic function as an algebraic function");
+        }
+        return null;
+    }
+
+    public Type getReturnType() {
+        if (func == null)
+            instantiateFunc();
+
+        return func.getReturnType();
+    }
+
+    public void finish() {
+        if (func == null)
+            instantiateFunc();
+
+        func.finish();
+    }
+
+    public Schema outputSchema(Schema input) {
+        if (func == null)
+            instantiateFunc();
+
+        return func.outputSchema(input);
+    }
+
+    public Boolean isAsynchronous() {
+        if (func == null)
+            instantiateFunc();
+        
+        return func.isAsynchronous();
+    }
+
+    @Override
+    public String name() {
+        if(funcSpec!=null)
+            return "POUserFunc" + "(" + funcSpec + ")" + " - " + mKey.toString();
         else
             return "POUserFunc" + "(" + "DummySpec" + ")" + " - " + mKey.toString();
-	}
+    }
 
-	@Override
-	public boolean supportsMultipleInputs() {
+    @Override
+    public boolean supportsMultipleInputs() {
 
-		return false;
-	}
+        return false;
+    }
 
-	@Override
-	public boolean supportsMultipleOutputs() {
+    @Override
+    public boolean supportsMultipleOutputs() {
 
-		return false;
-	}
+        return false;
+    }
 
-	@Override
-	public void visit(PhyPlanVisitor v) throws VisitorException {
+    @Override
+    public void visit(PhyPlanVisitor v) throws VisitorException {
 
-		v.visitUserFunc(this);
-	}
+        v.visitUserFunc(this);
+    }
 
 }

Modified: incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/expressionOperators/POBinCond.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/expressionOperators/POBinCond.java?rev=656043&r1=656042&r2=656043&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/expressionOperators/POBinCond.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/expressionOperators/POBinCond.java Tue May 13 15:52:02 2008
@@ -31,125 +31,125 @@
 import org.apache.pig.impl.plan.VisitorException;
 
 public class POBinCond extends ExpressionOperator {
-	ExpressionOperator cond;
-	ExpressionOperator lhs;
-	ExpressionOperator rhs;
-	
-	public POBinCond(OperatorKey k) {
-		super(k);
-		// TODO Auto-generated constructor stub
-	}
-	
-	public POBinCond(OperatorKey k, int rp) {
-		super(k, rp);
-	}
-	
-	public POBinCond(OperatorKey k, int rp, ExpressionOperator cond, ExpressionOperator lhs, ExpressionOperator rhs) {
-		super(k, rp);
-		this.cond = cond;
-		this.lhs = lhs;
-		this.rhs = rhs;
-	}
-	
-	/*private Result getNext() throws ExecException {
-		
-		Result res = cond.processInput();
-		return ((Boolean)res.result) == true ? lhs.processInput() : rhs.processInput();
-	}*/
-
-	@Override
-	public Result getNext(Boolean b) throws ExecException {
-		Result res = cond.getNext(b);
-		return ((Boolean)res.result) == true ? lhs.getNext(b) : rhs.getNext(b);
-		
-	}
-
-	@Override
-	public Result getNext(DataBag db) throws ExecException {
-		Result res = cond.getNext(db);
-		return ((Boolean)res.result) == true ? lhs.getNext(db) : rhs.getNext(db);
-	}
-
-	@Override
-	public Result getNext(DataByteArray ba) throws ExecException {
-		Result res = cond.getNext(ba);
-		return ((Boolean)res.result) == true ? lhs.getNext(ba) : rhs.getNext(ba);
-	}
-
-	@Override
-	public Result getNext(Double d) throws ExecException {
-		Result res = cond.getNext(d);
-		return ((Boolean)res.result) == true ? lhs.getNext(d) : rhs.getNext(d);
-	}
-
-	@Override
-	public Result getNext(Float f) throws ExecException {
-		Result res = cond.getNext(f);
-		return ((Boolean)res.result) == true ? lhs.getNext(f) : rhs.getNext(f);
-	}
-
-	@Override
-	public Result getNext(Integer i) throws ExecException {
-		Result res = cond.getNext(i);
-		return ((Boolean)res.result) == true ? lhs.getNext(i) : rhs.getNext(i);
-	}
-
-	@Override
-	public Result getNext(Long l) throws ExecException {
-		Result res = cond.getNext(l);
-		return ((Boolean)res.result) == true ? lhs.getNext(l) : rhs.getNext(l);
-	}
-
-	@Override
-	public Result getNext(Map m) throws ExecException {
-		Result res = cond.getNext(m);
-		return ((Boolean)res.result) == true ? lhs.getNext(m) : rhs.getNext(m);
-	}
-
-	@Override
-	public Result getNext(String s) throws ExecException {
-		Result res = cond.getNext(s);
-		return ((Boolean)res.result) == true ? lhs.getNext(s) : rhs.getNext(s);
-	}
-
-	@Override
-	public Result getNext(Tuple t) throws ExecException {
-		Result res = cond.getNext(t);
-		return ((Boolean)res.result) == true ? lhs.getNext(t) : rhs.getNext(t);
-	}
-
-	@Override
-	public void visit(ExprPlanVisitor v) throws VisitorException {
-		v.visitBinCond(this);
-	}
-
-	@Override
-	public String name() {
-		return "POBinCond - " + mKey.toString();
-	}
-	
-	@Override
-	public void attachInput(Tuple t) {
-		cond.attachInput(t);
-		lhs.attachInput(t);
-		rhs.attachInput(t);
-	}
-	
-	public void setCond(ExpressionOperator condOp) {
-		this.cond = condOp;
-	}
-	
-	public void setRhs(ExpressionOperator rhs) {
-		this.rhs = rhs;
-	}
-	
-	public void setLhs(ExpressionOperator lhs) {
-		this.lhs = lhs;
-	}
-
-	@Override
-	public boolean supportsMultipleInputs() {
-		return true;
-	}
+    ExpressionOperator cond;
+    ExpressionOperator lhs;
+    ExpressionOperator rhs;
+    
+    public POBinCond(OperatorKey k) {
+        super(k);
+        // TODO Auto-generated constructor stub
+    }
+    
+    public POBinCond(OperatorKey k, int rp) {
+        super(k, rp);
+    }
+    
+    public POBinCond(OperatorKey k, int rp, ExpressionOperator cond, ExpressionOperator lhs, ExpressionOperator rhs) {
+        super(k, rp);
+        this.cond = cond;
+        this.lhs = lhs;
+        this.rhs = rhs;
+    }
+    
+    /*private Result getNext() throws ExecException {
+        
+        Result res = cond.processInput();
+        return ((Boolean)res.result) == true ? lhs.processInput() : rhs.processInput();
+    }*/
+
+    @Override
+    public Result getNext(Boolean b) throws ExecException {
+        Result res = cond.getNext(b);
+        return ((Boolean)res.result) == true ? lhs.getNext(b) : rhs.getNext(b);
+        
+    }
+
+    @Override
+    public Result getNext(DataBag db) throws ExecException {
+        Result res = cond.getNext(db);
+        return ((Boolean)res.result) == true ? lhs.getNext(db) : rhs.getNext(db);
+    }
+
+    @Override
+    public Result getNext(DataByteArray ba) throws ExecException {
+        Result res = cond.getNext(ba);
+        return ((Boolean)res.result) == true ? lhs.getNext(ba) : rhs.getNext(ba);
+    }
+
+    @Override
+    public Result getNext(Double d) throws ExecException {
+        Result res = cond.getNext(d);
+        return ((Boolean)res.result) == true ? lhs.getNext(d) : rhs.getNext(d);
+    }
+
+    @Override
+    public Result getNext(Float f) throws ExecException {
+        Result res = cond.getNext(f);
+        return ((Boolean)res.result) == true ? lhs.getNext(f) : rhs.getNext(f);
+    }
+
+    @Override
+    public Result getNext(Integer i) throws ExecException {
+        Result res = cond.getNext(i);
+        return ((Boolean)res.result) == true ? lhs.getNext(i) : rhs.getNext(i);
+    }
+
+    @Override
+    public Result getNext(Long l) throws ExecException {
+        Result res = cond.getNext(l);
+        return ((Boolean)res.result) == true ? lhs.getNext(l) : rhs.getNext(l);
+    }
+
+    @Override
+    public Result getNext(Map m) throws ExecException {
+        Result res = cond.getNext(m);
+        return ((Boolean)res.result) == true ? lhs.getNext(m) : rhs.getNext(m);
+    }
+
+    @Override
+    public Result getNext(String s) throws ExecException {
+        Result res = cond.getNext(s);
+        return ((Boolean)res.result) == true ? lhs.getNext(s) : rhs.getNext(s);
+    }
+
+    @Override
+    public Result getNext(Tuple t) throws ExecException {
+        Result res = cond.getNext(t);
+        return ((Boolean)res.result) == true ? lhs.getNext(t) : rhs.getNext(t);
+    }
+
+    @Override
+    public void visit(ExprPlanVisitor v) throws VisitorException {
+        v.visitBinCond(this);
+    }
+
+    @Override
+    public String name() {
+        return "POBinCond - " + mKey.toString();
+    }
+    
+    @Override
+    public void attachInput(Tuple t) {
+        cond.attachInput(t);
+        lhs.attachInput(t);
+        rhs.attachInput(t);
+    }
+    
+    public void setCond(ExpressionOperator condOp) {
+        this.cond = condOp;
+    }
+    
+    public void setRhs(ExpressionOperator rhs) {
+        this.rhs = rhs;
+    }
+    
+    public void setLhs(ExpressionOperator lhs) {
+        this.lhs = lhs;
+    }
+
+    @Override
+    public boolean supportsMultipleInputs() {
+        return true;
+    }
 
 }

Modified: incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/expressionOperators/unaryExprOps/PONegative.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/expressionOperators/unaryExprOps/PONegative.java?rev=656043&r1=656042&r2=656043&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/expressionOperators/unaryExprOps/PONegative.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/expressionOperators/unaryExprOps/PONegative.java Tue May 13 15:52:02 2008
@@ -27,72 +27,72 @@
 
 public class PONegative extends UnaryExpressionOperator {
 
-	public PONegative(OperatorKey k, int rp) {
-		super(k, rp);
-		
-	}
-
-	public PONegative(OperatorKey k) {
-		super(k);
-		
-	}
-	
-	public PONegative(OperatorKey k, int rp, ExpressionOperator input) {
-		super(k, rp);
-		this.input = input;
-	}
-
-	@Override
-	public void visit(ExprPlanVisitor v) throws VisitorException {
-		v.visitNegative(this);
-	}
-
-	@Override
-	public String name() {
-		// TODO Auto-generated method stub
-		return "PONegative - " + mKey.toString();
-	}
-
-	@Override
-	public Result getNext(Double d) throws ExecException {
-		Result res = input.getNext(d);
-		if(res.returnStatus == POStatus.STATUS_OK) {
-			res.result = -1*((Double)res.result);
-		}
-		return res;
-	}
-
-	@Override
-	public Result getNext(Float f) throws ExecException {
-		Result res = input.getNext(f);
-		if(res.returnStatus == POStatus.STATUS_OK) {
-			res.result = -1*((Float)res.result);
-		}
-		return res;
-	}
-
-	@Override
-	public Result getNext(Integer i) throws ExecException {
-		Result res = input.getNext(i);
-		if(res.returnStatus == POStatus.STATUS_OK) {
-			res.result = -1*((Integer)res.result);
-		}
-		return res;
-	}
-
-	@Override
-	public Result getNext(Long l) throws ExecException {
-		Result res = input.getNext(l);
-		if(res.returnStatus == POStatus.STATUS_OK) {
-			res.result = -1*((Long)res.result);
-		}
-		return res;
-	}
-	
-	public void setInput(ExpressionOperator in) {
-		this.input = in;
-	}
-	
-	
+    public PONegative(OperatorKey k, int rp) {
+        super(k, rp);
+        
+    }
+
+    public PONegative(OperatorKey k) {
+        super(k);
+        
+    }
+    
+    public PONegative(OperatorKey k, int rp, ExpressionOperator input) {
+        super(k, rp);
+        this.input = input;
+    }
+
+    @Override
+    public void visit(ExprPlanVisitor v) throws VisitorException {
+        v.visitNegative(this);
+    }
+
+    @Override
+    public String name() {
+        // TODO Auto-generated method stub
+        return "PONegative - " + mKey.toString();
+    }
+
+    @Override
+    public Result getNext(Double d) throws ExecException {
+        Result res = input.getNext(d);
+        if(res.returnStatus == POStatus.STATUS_OK) {
+            res.result = -1*((Double)res.result);
+        }
+        return res;
+    }
+
+    @Override
+    public Result getNext(Float f) throws ExecException {
+        Result res = input.getNext(f);
+        if(res.returnStatus == POStatus.STATUS_OK) {
+            res.result = -1*((Float)res.result);
+        }
+        return res;
+    }
+
+    @Override
+    public Result getNext(Integer i) throws ExecException {
+        Result res = input.getNext(i);
+        if(res.returnStatus == POStatus.STATUS_OK) {
+            res.result = -1*((Integer)res.result);
+        }
+        return res;
+    }
+
+    @Override
+    public Result getNext(Long l) throws ExecException {
+        Result res = input.getNext(l);
+        if(res.returnStatus == POStatus.STATUS_OK) {
+            res.result = -1*((Long)res.result);
+        }
+        return res;
+    }
+    
+    public void setInput(ExpressionOperator in) {
+        this.input = in;
+    }
+    
+    
 
 }

Modified: incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/expressionOperators/unaryExprOps/UnaryExpressionOperator.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/expressionOperators/unaryExprOps/UnaryExpressionOperator.java?rev=656043&r1=656042&r2=656043&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/expressionOperators/unaryExprOps/UnaryExpressionOperator.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/expressionOperators/unaryExprOps/UnaryExpressionOperator.java Tue May 13 15:52:02 2008
@@ -24,24 +24,24 @@
 
 public abstract class UnaryExpressionOperator extends ExpressionOperator {
 
-	ExpressionOperator input;
-	
-	public UnaryExpressionOperator(OperatorKey k, int rp) {
-		super(k, rp);
-		
-	}
+    ExpressionOperator input;
+    
+    public UnaryExpressionOperator(OperatorKey k, int rp) {
+        super(k, rp);
+        
+    }
 
-	public UnaryExpressionOperator(OperatorKey k) {
-		super(k);
-		
-	}
+    public UnaryExpressionOperator(OperatorKey k) {
+        super(k);
+        
+    }
 
-	@Override
-	public boolean supportsMultipleInputs() {
-		// TODO Auto-generated method stub
-		return false;
-	}
-	
-	
+    @Override
+    public boolean supportsMultipleInputs() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+    
+    
 
 }

Modified: incubator/pig/branches/types/src/org/apache/pig/impl/plan/OperatorPlan.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/plan/OperatorPlan.java?rev=656043&r1=656042&r2=656043&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/impl/plan/OperatorPlan.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/impl/plan/OperatorPlan.java Tue May 13 15:52:02 2008
@@ -337,8 +337,8 @@
             connect(oper, leaf);
         }
     }
-	
-	public boolean isSingleLeafPlan() {
+    
+    public boolean isSingleLeafPlan() {
         List<E> tmpList = getLeaves() ;
         return tmpList.size() == 1 ;
     }

Modified: incubator/pig/branches/types/src/org/apache/pig/impl/plan/optimizer/Rule.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/plan/optimizer/Rule.java?rev=656043&r1=656042&r2=656043&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/impl/plan/optimizer/Rule.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/impl/plan/optimizer/Rule.java Tue May 13 15:52:02 2008
@@ -37,9 +37,9 @@
 public class Rule<O extends Operator, P extends OperatorPlan<O>> {
 
     public List<String> nodes;
-	public Map<Integer, Integer> edges;
-	public List<Boolean> required;
-	public Transformer<O, P> transformer;
+    public Map<Integer, Integer> edges;
+    public List<Boolean> required;
+    public Transformer<O, P> transformer;
 
     /**
      * @param nodes List of node types to look for.

Modified: incubator/pig/branches/types/src/org/apache/pig/impl/plan/optimizer/RuleMatcher.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/plan/optimizer/RuleMatcher.java?rev=656043&r1=656042&r2=656043&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/impl/plan/optimizer/RuleMatcher.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/impl/plan/optimizer/RuleMatcher.java Tue May 13 15:52:02 2008
@@ -35,7 +35,7 @@
 public class RuleMatcher<O extends Operator, P extends OperatorPlan<O>> {
 
     private Rule<O, P> mRule;
-	private List<O> mMatches;
+    private List<O> mMatches;
     private P mPlan; // for convience.
 
     /**
@@ -50,20 +50,20 @@
         mPlan = mRule.transformer.getPlan();
         // Add sufficient slots in the matches array
         for (int i = 0; i < sz; i++) mMatches.add(null);
-	    return beginMatch(mPlan.getRoots());
+        return beginMatch(mPlan.getRoots());
     }
 
-	/**
-	 * @return a list that with the instances of nodes that matched the
+    /**
+     * @return a list that with the instances of nodes that matched the
      * pattern defined by
-	 * the rule.  The nodes will be in the vector in the order they are
-	 * specified in the rule.
-	 */
-	List<O> getMatches() {
+     * the rule.  The nodes will be in the vector in the order they are
+     * specified in the rule.
+     */
+    List<O> getMatches() {
         return mMatches;
     }
 
-	/*
+    /*
      * This pattern matching is fairly simple and makes some important
      * assumptions.
      * 1)  The pattern to be matched must be expressable as a simple list.  That
@@ -77,64 +77,64 @@
     private boolean beginMatch(List<O> nodes) {
         if (nodes == null) return false;
         for (O op : nodes) {
-		    List<O> successors = new ArrayList<O>();
-		    if (op.getClass().getName().equals(mRule.nodes.get(0))) {
-			    mMatches.set(0, op);
-			    // Follow the edge to see the next node we should be looking for.
-			    Integer nextOpNum = mRule.edges.get(0);
+            List<O> successors = new ArrayList<O>();
+            if (op.getClass().getName().equals(mRule.nodes.get(0))) {
+                mMatches.set(0, op);
+                // Follow the edge to see the next node we should be looking for.
+                Integer nextOpNum = mRule.edges.get(0);
                 if (nextOpNum == null) {
-				    // This was looking for a single node
-				    return true;
-			    }
-			    successors = mPlan.getSuccessors(op);
+                    // This was looking for a single node
+                    return true;
+                }
+                successors = mPlan.getSuccessors(op);
                 if (successors == null) return false;
                 for (O successorOp : successors) {
-				    if (continueMatch(successorOp, nextOpNum)) return true;
-			    }
-		    }
-
-		    // That node didn't match.  Go to this nodes successors and see if
-		    // any of them match.
-		    successors = mPlan.getSuccessors(op);
-		    if (beginMatch(successors)) return true;
-	    }
-	    // If we get here we haven't found it.
-	    return false;
+                    if (continueMatch(successorOp, nextOpNum)) return true;
+                }
+            }
+
+            // That node didn't match.  Go to this nodes successors and see if
+            // any of them match.
+            successors = mPlan.getSuccessors(op);
+            if (beginMatch(successors)) return true;
+        }
+        // If we get here we haven't found it.
+        return false;
     }
 
-	private boolean continueMatch(O current, Integer nodeNumber) {
-	    if (current.getClass().getName() == mRule.nodes.get(nodeNumber)) {
-		    mMatches.set(nodeNumber, current);
-
-		    // Follow the edge to see the next node we should be looking for.
-		    Integer nextOpNum = mRule.edges.get(nodeNumber);
-		    if (nextOpNum == null) {
-			    // We've comleted the match
-			    return true;
-		    }
+    private boolean continueMatch(O current, Integer nodeNumber) {
+        if (current.getClass().getName() == mRule.nodes.get(nodeNumber)) {
+            mMatches.set(nodeNumber, current);
+
+            // Follow the edge to see the next node we should be looking for.
+            Integer nextOpNum = mRule.edges.get(nodeNumber);
+            if (nextOpNum == null) {
+                // We've comleted the match
+                return true;
+            }
             List<O> successors = new ArrayList<O>();
-		    successors = mPlan.getSuccessors(current);
+            successors = mPlan.getSuccessors(current);
             if (successors == null) return false;
             for (O successorOp : successors) {
-			    if (continueMatch(successorOp, nextOpNum)) return true;
-		    }
-	    } else if (!mRule.required.get(nodeNumber)) {
-		    // This node was optional, so it's okay if we don't match, keep
-		    // going anyway.  Keep looking for the current node (don't find our
-		    // successors, but look for the next edge.
-		    Integer nextOpNum = mRule.edges.get(nodeNumber);
-		    if (nextOpNum == null) {
-			    // We've comleted the match
-			    return true;
-		    }
-		    if (continueMatch(current, nextOpNum)) return true;
-	    }
-
-	    // We can arrive here either because we didn't match at this node or
-	    // further down the line.  One way or another we need to remove ourselves
-	    // from the match vector and return false.
-	    mMatches.set(nodeNumber, null);
-	    return false;
+                if (continueMatch(successorOp, nextOpNum)) return true;
+            }
+        } else if (!mRule.required.get(nodeNumber)) {
+            // This node was optional, so it's okay if we don't match, keep
+            // going anyway.  Keep looking for the current node (don't find our
+            // successors, but look for the next edge.
+            Integer nextOpNum = mRule.edges.get(nodeNumber);
+            if (nextOpNum == null) {
+                // We've comleted the match
+                return true;
+            }
+            if (continueMatch(current, nextOpNum)) return true;
+        }
+
+        // We can arrive here either because we didn't match at this node or
+        // further down the line.  One way or another we need to remove ourselves
+        // from the match vector and return false.
+        mMatches.set(nodeNumber, null);
+        return false;
     }
 
 }