You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by ol...@apache.org on 2008/02/07 00:09:55 UTC

svn commit: r619213 [5/5] - in /incubator/pig/trunk: ./ src/org/apache/pig/ src/org/apache/pig/backend/executionengine/ src/org/apache/pig/backend/hadoop/datastorage/ src/org/apache/pig/backend/hadoop/executionengine/ src/org/apache/pig/backend/hadoop/...

Modified: incubator/pig/trunk/src/org/apache/pig/impl/logicalLayer/LogicalPlanBuilder.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/src/org/apache/pig/impl/logicalLayer/LogicalPlanBuilder.java?rev=619213&r1=619212&r2=619213&view=diff
==============================================================================
--- incubator/pig/trunk/src/org/apache/pig/impl/logicalLayer/LogicalPlanBuilder.java (original)
+++ incubator/pig/trunk/src/org/apache/pig/impl/logicalLayer/LogicalPlanBuilder.java Wed Feb  6 15:09:43 2008
@@ -31,19 +31,19 @@
  * 
  */
 public class LogicalPlanBuilder {
-	public static ClassLoader classloader = LogicalPlanBuilder.class.getClassLoader();
-	private PigContext pigContext;
+    public static ClassLoader classloader = LogicalPlanBuilder.class.getClassLoader();
+    private PigContext pigContext;
     public LogicalPlanBuilder(PigContext pigContext) {
-		this.pigContext = pigContext;
-	}
+        this.pigContext = pigContext;
+    }
 
-	public LogicalPlan parse(String scope, 
-	                         String query, 
-	                         Map<String, LogicalPlan> aliases,
-	                         Map<OperatorKey, LogicalOperator> opTable)
-		throws IOException, ParseException {
-		ByteArrayInputStream in = new ByteArrayInputStream(query.getBytes());		
-		QueryParser parser = new QueryParser(in, pigContext, scope, aliases, opTable);
-		return parser.Parse();		
-	}
+    public LogicalPlan parse(String scope, 
+                             String query, 
+                             Map<String, LogicalPlan> aliases,
+                             Map<OperatorKey, LogicalOperator> opTable)
+        throws IOException, ParseException {
+        ByteArrayInputStream in = new ByteArrayInputStream(query.getBytes());        
+        QueryParser parser = new QueryParser(in, pigContext, scope, aliases, opTable);
+        return parser.Parse();        
+    }
 }

Modified: incubator/pig/trunk/src/org/apache/pig/impl/logicalLayer/schema/AtomSchema.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/src/org/apache/pig/impl/logicalLayer/schema/AtomSchema.java?rev=619213&r1=619212&r2=619213&view=diff
==============================================================================
--- incubator/pig/trunk/src/org/apache/pig/impl/logicalLayer/schema/AtomSchema.java (original)
+++ incubator/pig/trunk/src/org/apache/pig/impl/logicalLayer/schema/AtomSchema.java Wed Feb  6 15:09:43 2008
@@ -27,36 +27,36 @@
  *
  */
 public class AtomSchema extends Schema {
-	private static final long serialVersionUID = 1L;
-	
+    private static final long serialVersionUID = 1L;
+    
     public AtomSchema(String alias) {
         getAliases().add(alias);
     }
     
-	@Override
-	public int colFor(String alias) {
-    	return -1;
+    @Override
+    public int colFor(String alias) {
+        return -1;
     }
     
     @Override
-	public Schema schemaFor(int col) {
+    public Schema schemaFor(int col) {
         return null;
     }
     
     @Override
-	public AtomSchema copy(){
-    	return (AtomSchema)super.copy();
+    public AtomSchema copy(){
+        return (AtomSchema)super.copy();
     }
     
     @Override
-	public List<Schema> flatten(){
-    	List<Schema> ret = new ArrayList<Schema>();
-    	ret.add(this);
-    	return ret;
+    public List<Schema> flatten(){
+        List<Schema> ret = new ArrayList<Schema>();
+        ret.add(this);
+        return ret;
     }
     
     @Override
-	public String toString(){
-    	return getAlias();
+    public String toString(){
+        return getAlias();
     }
 }

Modified: incubator/pig/trunk/src/org/apache/pig/impl/logicalLayer/schema/Schema.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/src/org/apache/pig/impl/logicalLayer/schema/Schema.java?rev=619213&r1=619212&r2=619213&view=diff
==============================================================================
--- incubator/pig/trunk/src/org/apache/pig/impl/logicalLayer/schema/Schema.java (original)
+++ incubator/pig/trunk/src/org/apache/pig/impl/logicalLayer/schema/Schema.java Wed Feb  6 15:09:43 2008
@@ -30,15 +30,15 @@
 
 public abstract class Schema implements Serializable {
 
-	protected Set<String> aliases = new HashSet<String>();    
+    protected Set<String> aliases = new HashSet<String>();    
 
-	public Schema copy(){
-    	try{
-    		return (Schema)ObjectSerializer.deserialize(ObjectSerializer.serialize(this));
-    	}catch (IOException e){
-    		e.printStackTrace();
-    		throw new RuntimeException(e);
-    	}
+    public Schema copy(){
+        try{
+            return (Schema)ObjectSerializer.deserialize(ObjectSerializer.serialize(this));
+        }catch (IOException e){
+            e.printStackTrace();
+            throw new RuntimeException(e);
+        }
     }
     public abstract int colFor(String alias);
     public abstract Schema schemaFor(int col);
@@ -47,25 +47,25 @@
     public abstract List<Schema> flatten();
 
     public void setAlias(String alias) {
-		if (alias!=null)
-			aliases.add(alias);
-	}
+        if (alias!=null)
+            aliases.add(alias);
+    }
     
     public void removeAlias(String alias){
-    	aliases.remove(alias);
+        aliases.remove(alias);
     }
     
     public void removeAllAliases(){
-    	aliases.clear();
+        aliases.clear();
     }
     public Set<String> getAliases() {
-    	return aliases;
+        return aliases;
+    }
+    public String getAlias() {
+        Iterator<String> iter = aliases.iterator();
+        if (iter.hasNext())
+            return iter.next();
+        else
+            return null;
     }
-	public String getAlias() {
-		Iterator<String> iter = aliases.iterator();
-		if (iter.hasNext())
-			return iter.next();
-		else
-			return null;
-	}
 }

Modified: incubator/pig/trunk/src/org/apache/pig/impl/logicalLayer/schema/TupleSchema.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/src/org/apache/pig/impl/logicalLayer/schema/TupleSchema.java?rev=619213&r1=619212&r2=619213&view=diff
==============================================================================
--- incubator/pig/trunk/src/org/apache/pig/impl/logicalLayer/schema/TupleSchema.java (original)
+++ incubator/pig/trunk/src/org/apache/pig/impl/logicalLayer/schema/TupleSchema.java Wed Feb  6 15:09:43 2008
@@ -33,30 +33,30 @@
  *
  */
 public class TupleSchema extends Schema implements Serializable {
-	
-	private static final long serialVersionUID = 1L;
-	private static final String QUALIFIER = "::";
-	
-	public List<Schema>        fields  = new ArrayList<Schema>();
+    
+    private static final long serialVersionUID = 1L;
+    private static final String QUALIFIER = "::";
+    
+    public List<Schema>        fields  = new ArrayList<Schema>();
     public Map<String, Integer> mapping = new HashMap<String, Integer>();
     private boolean                isBag   = false;
     
     
-				@Override
-	public int colFor(String alias) {        
-        if (mapping.containsKey(alias)) {        	
+                @Override
+    public int colFor(String alias) {        
+        if (mapping.containsKey(alias)) {            
             return mapping.get(alias);
         }
         else if(alias.matches(".*::.*")) {
-        	String[] temp = alias.split("::");
-        	if(mapping.containsKey(temp[temp.length-1]))
-        		return mapping.get(temp[temp.length-1]);
+            String[] temp = alias.split("::");
+            if(mapping.containsKey(temp[temp.length-1]))
+                return mapping.get(temp[temp.length-1]);
         }
         return -1;
     }
 
     @Override
-	public Schema schemaFor(int col) {
+    public Schema schemaFor(int col) {
         if (col < fields.size()) {
             return fields.get(col);
         }
@@ -65,7 +65,7 @@
 
     
     public void add(Schema sc){
-    	add(sc,false);
+        add(sc,false);
     }
     
     
@@ -77,11 +77,11 @@
      
         for (String alias: sc.aliases){
             if (mapping.containsKey(alias)){
-            	if (!ignoreConflicts)
-            		throw new RuntimeException("Duplicate alias: " + sc.getAlias());
-            	else
-            		mapping.remove(alias);
-            		
+                if (!ignoreConflicts)
+                    throw new RuntimeException("Duplicate alias: " + sc.getAlias());
+                else
+                    mapping.remove(alias);
+                    
             }else{
                 mapping.put(alias, pos);
             }
@@ -93,11 +93,11 @@
     }
 
     @Override
-	public String toString() {
+    public String toString() {
         StringBuilder buf = new StringBuilder();
         if (getAlias()!=null){
-        	buf.append(getAlias());
-        	buf.append(": ");
+            buf.append(getAlias());
+            buf.append(": ");
         }
         
         buf.append( "(" );
@@ -114,25 +114,25 @@
     }
 
     @Override
-	public TupleSchema copy(){
-    	return (TupleSchema)super.copy();
+    public TupleSchema copy(){
+        return (TupleSchema)super.copy();
     }
     
     @Override
-	public List<Schema> flatten(){
-    	for (Schema item: fields){
-    		for (String parentAlias: aliases){
-    			String[] childAliases = item.aliases.toArray(new String[0]);
-    			for (String childAlias: childAliases){
-    				item.aliases.add(parentAlias+QUALIFIER+childAlias);
-    			}
-    		}
-    	}
-    	return fields;
+    public List<Schema> flatten(){
+        for (Schema item: fields){
+            for (String parentAlias: aliases){
+                String[] childAliases = item.aliases.toArray(new String[0]);
+                for (String childAlias: childAliases){
+                    item.aliases.add(parentAlias+QUALIFIER+childAlias);
+                }
+            }
+        }
+        return fields;
     }
     
     public List<Schema> getFields(){
-    	return fields;
+        return fields;
     }
     
     

Modified: incubator/pig/trunk/src/org/apache/pig/impl/physicalLayer/PhysicalOperator.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/src/org/apache/pig/impl/physicalLayer/PhysicalOperator.java?rev=619213&r1=619212&r2=619213&view=diff
==============================================================================
--- incubator/pig/trunk/src/org/apache/pig/impl/physicalLayer/PhysicalOperator.java (original)
+++ incubator/pig/trunk/src/org/apache/pig/impl/physicalLayer/PhysicalOperator.java Wed Feb  6 15:09:43 2008
@@ -44,9 +44,9 @@
         this.scope = scope;
         this.id = id;
         this.opTable = opTable;
-    	this.outputType = outputType;
-    	
-    	opTable.put(getOperatorKey(), this);
+        this.outputType = outputType;
+        
+        opTable.put(getOperatorKey(), this);
     }
     
     public OperatorKey getOperatorKey() {
@@ -86,7 +86,7 @@
     }
 
     public int getOutputType(){
-    	return outputType;
+        return outputType;
     }
 
     public abstract void visit(POVisitor v, String prfix);

Modified: incubator/pig/trunk/src/org/apache/pig/impl/util/DataBuffer.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/src/org/apache/pig/impl/util/DataBuffer.java?rev=619213&r1=619212&r2=619213&view=diff
==============================================================================
--- incubator/pig/trunk/src/org/apache/pig/impl/util/DataBuffer.java (original)
+++ incubator/pig/trunk/src/org/apache/pig/impl/util/DataBuffer.java Wed Feb  6 15:09:43 2008
@@ -26,22 +26,22 @@
 
 public class DataBuffer extends DataCollector {
     
-	public DataBuffer(){
-		super(null);
-	}
-	
+    public DataBuffer(){
+        super(null);
+    }
+    
     List<Datum> buf = Collections.synchronizedList(new LinkedList<Datum>());
 
     @Override
-	public void add(Datum d){
+    public void add(Datum d){
         if (d != null) buf.add(d);
     }
     
     public Datum removeFirst(){
         if (buf.isEmpty())
-        	return null;
+            return null;
         else
-        	return buf.remove(0);
+            return buf.remove(0);
     }
     
     /**
@@ -49,13 +49,13 @@
      * where we know that running an eval spec one item should produce one and only one item.
      */
     public Datum removeFirstAndAssertEmpty(){
-    	Datum d;
-    	if (isStale() || (d = removeFirst()) == null){
-    		throw new RuntimeException("Simple eval used but buffer found to be empty or stale");
-    	}
-    	if (!buf.isEmpty())
-    		throw new RuntimeException("Simple eval used but buffer found to have more than one datum");
-    	return d;
+        Datum d;
+        if (isStale() || (d = removeFirst()) == null){
+            throw new RuntimeException("Simple eval used but buffer found to be empty or stale");
+        }
+        if (!buf.isEmpty())
+            throw new RuntimeException("Simple eval used but buffer found to have more than one datum");
+        return d;
     }
     
     public boolean isEmpty() {

Modified: incubator/pig/trunk/src/org/apache/pig/impl/util/JarManager.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/src/org/apache/pig/impl/util/JarManager.java?rev=619213&r1=619212&r2=619213&view=diff
==============================================================================
--- incubator/pig/trunk/src/org/apache/pig/impl/util/JarManager.java (original)
+++ incubator/pig/trunk/src/org/apache/pig/impl/util/JarManager.java Wed Feb  6 15:09:43 2008
@@ -64,7 +64,7 @@
         }
 
         @Override
-		public boolean equals(Object obj) {
+        public boolean equals(Object obj) {
             if (!(obj instanceof JarListEntry))
                 return false;
             JarListEntry other = (JarListEntry) obj;
@@ -76,7 +76,7 @@
         }
 
         @Override
-		public int hashCode() {
+        public int hashCode() {
             return jar.hashCode() + (prefix == null ? 1 : prefix.hashCode());
         }
     }
@@ -97,16 +97,16 @@
     public static void createJar(OutputStream os, List<String> funcs, PigContext pigContext) throws ClassNotFoundException, IOException {
         Vector<JarListEntry> jarList = new Vector<JarListEntry>();
         for(String toSend: pigPackagesToSend) {
-        	addContainingJar(jarList, PigMapReduce.class, toSend, pigContext);
+            addContainingJar(jarList, PigMapReduce.class, toSend, pigContext);
         }
         ClassLoader pigClassLoader = PigMapReduce.class.getClassLoader();
         
         for (String func: funcs) {
             Class clazz = pigContext.getClassForAlias(func);
             if (clazz != null) {
-            	if (pigClassLoader == clazz.getClassLoader()) {
-            		continue;
-            	}
+                if (pigClassLoader == clazz.getClassLoader()) {
+                    continue;
+                }
                 addContainingJar(jarList, clazz, null, pigContext);
             }
         }
@@ -119,7 +119,7 @@
             mergeJar(jarFile, jarEntry.jar, jarEntry.prefix, contents);
         }
         for (int i = 0; i < pigContext.extraJars.size(); i++) {
-        	// System.err.println("Adding extra " + pigContext.extraJars.get(i));
+            // System.err.println("Adding extra " + pigContext.extraJars.get(i));
             mergeJar(jarFile, pigContext.extraJars.get(i), null, contents);
         }
         if (pigContext != null) {

Modified: incubator/pig/trunk/src/org/apache/pig/impl/util/PigLogger.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/src/org/apache/pig/impl/util/PigLogger.java?rev=619213&r1=619212&r2=619213&view=diff
==============================================================================
--- incubator/pig/trunk/src/org/apache/pig/impl/util/PigLogger.java (original)
+++ incubator/pig/trunk/src/org/apache/pig/impl/util/PigLogger.java Wed Feb  6 15:09:43 2008
@@ -34,10 +34,10 @@
  */ 
 public static Logger getLogger()
 {
-	if (mLogger == null) {
-		mLogger = Logger.getLogger("org.apache.pig");
-	}
-	return mLogger;
+    if (mLogger == null) {
+        mLogger = Logger.getLogger("org.apache.pig");
+    }
+    return mLogger;
 }
 
 /**
@@ -46,15 +46,15 @@
  */
 public static void setAppenderForJunit()
 {
-	if (!mHaveSetAppenders) {
-		Logger log = getLogger();
-		log.setLevel(Level.INFO);
-		ConsoleAppender screen = new ConsoleAppender(new PatternLayout());
-		screen.setThreshold(Level.INFO);
-		screen.setTarget(ConsoleAppender.SYSTEM_ERR);
-		log.addAppender(screen);
-		mHaveSetAppenders = true;
-	}
+    if (!mHaveSetAppenders) {
+        Logger log = getLogger();
+        log.setLevel(Level.INFO);
+        ConsoleAppender screen = new ConsoleAppender(new PatternLayout());
+        screen.setThreshold(Level.INFO);
+        screen.setTarget(ConsoleAppender.SYSTEM_ERR);
+        log.addAppender(screen);
+        mHaveSetAppenders = true;
+    }
 }
 
 

Modified: incubator/pig/trunk/src/org/apache/pig/tools/cmdline/CmdLineParser.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/src/org/apache/pig/tools/cmdline/CmdLineParser.java?rev=619213&r1=619212&r2=619213&view=diff
==============================================================================
--- incubator/pig/trunk/src/org/apache/pig/tools/cmdline/CmdLineParser.java (original)
+++ incubator/pig/trunk/src/org/apache/pig/tools/cmdline/CmdLineParser.java Wed Feb  6 15:09:43 2008
@@ -45,10 +45,10 @@
  */
 public CmdLineParser(String[] args)
 {
-	mArgs = args;
-	mArgNum = 0;
-	mShort = new HashMap<Character, ValueExpected>();
-	mLong = new HashMap<String, Character>();
+    mArgs = args;
+    mArgNum = 0;
+    mShort = new HashMap<Character, ValueExpected>();
+    mLong = new HashMap<String, Character>();
 }
 
 /**
@@ -63,20 +63,20 @@
  */
 public void registerOpt(char c, String s, ValueExpected ve)
 {
-	if (c == '-') {
-		throw new AssertionError("CmdLineParser:  '-' is not a legal single character designator.");
-	}
-
-	Character cc = new Character(c);
-	if (mShort.put(cc, ve) != null) {
-		throw new AssertionError("CmdLineParser:  You have already registered option " + cc.toString());
-	}
-
-	if (mLong != null) {
-		if (mLong.put(s, cc) != null) {
-			throw new AssertionError("CmdLineParser:  You have already registered option " + s);
-		}
-	}
+    if (c == '-') {
+        throw new AssertionError("CmdLineParser:  '-' is not a legal single character designator.");
+    }
+
+    Character cc = new Character(c);
+    if (mShort.put(cc, ve) != null) {
+        throw new AssertionError("CmdLineParser:  You have already registered option " + cc.toString());
+    }
+
+    if (mLong != null) {
+        if (mLong.put(s, cc) != null) {
+            throw new AssertionError("CmdLineParser:  You have already registered option " + s);
+        }
+    }
 }
 
 /**
@@ -89,75 +89,75 @@
  */
 public char getNextOpt() throws ParseException
 {
-	if (mArgNum >= mArgs.length) return EndOfOpts;
+    if (mArgNum >= mArgs.length) return EndOfOpts;
 
-	int offset = 1;
-	mVal = null;
-	try {
-		String arg = mArgs[mArgNum];
-		// If it doesn't start with a dash, we'll assume we've reached the end of the
-		// arguments.  We need to decrement mArgNum because the finally at the end is
-		// going to increment it.
-		if (arg.charAt(0) != '-') {
-			mArgNum--;
-			return EndOfOpts;
-		}
-	
-		// Strip any dashes off of the beginning
-		for (int i = 1; i < arg.length() && arg.charAt(i) == '-'; i++) offset++;
-	
-		// If they passed us a - or -- then quit
-		if (offset == arg.length()) return EndOfOpts;
-
-		Character cc = null;
-		if (arg.substring(offset).length() == 1) {
-			cc = new Character(arg.substring(offset).charAt(0));
-		} else {
-			cc = mLong.get(arg.substring(offset));
-			if (cc == null) {
-				Integer ii = new Integer(mArgNum + 1);
-				String errMsg = "Found unknown option (" + arg + ") at position " +
-					ii.toString();
-				throw new ParseException(errMsg, mArgNum);
-			}
-		}
-
-		ValueExpected ve = mShort.get(cc);
-		if (ve == null) {
-			Integer ii = new Integer(mArgNum + 1);
-			String errMsg = "Found unknown option (" + arg + ") at position " +
-				ii.toString();
-			throw new ParseException(errMsg, mArgNum);
-		}
-
-		switch (ve) {
-		case NOT_ACCEPTED: 
-			return cc.charValue();
-
-		case REQUIRED: 
-			// If it requires an option, make sure there is one.
-			if (mArgNum + 1 >= mArgs.length || mArgs[mArgNum + 1].charAt(0) == '-') {
-				String errMsg = "Option " + arg +
-					" requires a value but you did not provide one.";
-				throw new ParseException(errMsg, mArgNum);
-			}
-			mVal = new String(mArgs[++mArgNum]);
-			return cc.charValue();
-
-		case OPTIONAL:
-			if (mArgNum + 1 < mArgs.length && mArgs[mArgNum + 1].charAt(0) != '-') {
-				mVal = new String(mArgs[++mArgNum]);
-			}
-			return cc.charValue();
-
-		default:
-			throw new AssertionError("Unknown valueExpected state");
-
-		}
-
-	} finally {
-		mArgNum++;
-	}
+    int offset = 1;
+    mVal = null;
+    try {
+        String arg = mArgs[mArgNum];
+        // If it doesn't start with a dash, we'll assume we've reached the end of the
+        // arguments.  We need to decrement mArgNum because the finally at the end is
+        // going to increment it.
+        if (arg.charAt(0) != '-') {
+            mArgNum--;
+            return EndOfOpts;
+        }
+    
+        // Strip any dashes off of the beginning
+        for (int i = 1; i < arg.length() && arg.charAt(i) == '-'; i++) offset++;
+    
+        // If they passed us a - or -- then quit
+        if (offset == arg.length()) return EndOfOpts;
+
+        Character cc = null;
+        if (arg.substring(offset).length() == 1) {
+            cc = new Character(arg.substring(offset).charAt(0));
+        } else {
+            cc = mLong.get(arg.substring(offset));
+            if (cc == null) {
+                Integer ii = new Integer(mArgNum + 1);
+                String errMsg = "Found unknown option (" + arg + ") at position " +
+                    ii.toString();
+                throw new ParseException(errMsg, mArgNum);
+            }
+        }
+
+        ValueExpected ve = mShort.get(cc);
+        if (ve == null) {
+            Integer ii = new Integer(mArgNum + 1);
+            String errMsg = "Found unknown option (" + arg + ") at position " +
+                ii.toString();
+            throw new ParseException(errMsg, mArgNum);
+        }
+
+        switch (ve) {
+        case NOT_ACCEPTED: 
+            return cc.charValue();
+
+        case REQUIRED: 
+            // If it requires an option, make sure there is one.
+            if (mArgNum + 1 >= mArgs.length || mArgs[mArgNum + 1].charAt(0) == '-') {
+                String errMsg = "Option " + arg +
+                    " requires a value but you did not provide one.";
+                throw new ParseException(errMsg, mArgNum);
+            }
+            mVal = new String(mArgs[++mArgNum]);
+            return cc.charValue();
+
+        case OPTIONAL:
+            if (mArgNum + 1 < mArgs.length && mArgs[mArgNum + 1].charAt(0) != '-') {
+                mVal = new String(mArgs[++mArgNum]);
+            }
+            return cc.charValue();
+
+        default:
+            throw new AssertionError("Unknown valueExpected state");
+
+        }
+
+    } finally {
+        mArgNum++;
+    }
 }
 
 /**
@@ -168,11 +168,11 @@
  */
 public String[] getRemainingArgs()
 {
-	if (mArgNum == mArgs.length) return null;
+    if (mArgNum == mArgs.length) return null;
 
-	String[] remainders = new String[mArgs.length - mArgNum];
-	System.arraycopy(mArgs, mArgNum, remainders, 0, remainders.length);
-	return remainders;
+    String[] remainders = new String[mArgs.length - mArgNum];
+    System.arraycopy(mArgs, mArgNum, remainders, 0, remainders.length);
+    return remainders;
 }
 
 /**
@@ -182,7 +182,7 @@
  */
 public String getValStr()
 {
-	return mVal;
+    return mVal;
 }
 
 /**
@@ -193,8 +193,8 @@
  */
 public Integer getValInt() throws NumberFormatException
 {
-	if (mVal == null) return null;
-	else return new Integer(mVal);
+    if (mVal == null) return null;
+    else return new Integer(mVal);
 }
 
 private String[] mArgs;

Modified: incubator/pig/trunk/src/org/apache/pig/tools/grunt/Grunt.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/src/org/apache/pig/tools/grunt/Grunt.java?rev=619213&r1=619212&r2=619213&view=diff
==============================================================================
--- incubator/pig/trunk/src/org/apache/pig/tools/grunt/Grunt.java (original)
+++ incubator/pig/trunk/src/org/apache/pig/tools/grunt/Grunt.java Wed Feb  6 15:09:43 2008
@@ -27,34 +27,34 @@
 
 public class Grunt 
 {
-	BufferedReader in;
-	PigServer pig;
-	GruntParser parser;	
+    BufferedReader in;
+    PigServer pig;
+    GruntParser parser;    
 
-	public Grunt(BufferedReader in, PigContext pigContext) throws ExecException
-	{
-		this.in = in;
-		this.pig = new PigServer(pigContext);
-		
-		if (in != null)
-		{
-			parser = new GruntParser(in);
-			parser.setParams(pig);	
-		}
-	}
+    public Grunt(BufferedReader in, PigContext pigContext) throws ExecException
+    {
+        this.in = in;
+        this.pig = new PigServer(pigContext);
+        
+        if (in != null)
+        {
+            parser = new GruntParser(in);
+            parser.setParams(pig);    
+        }
+    }
 
     public void run() {
-	parser.setInteractive(true);
-	parser.parseContOnError();
+    parser.setInteractive(true);
+    parser.parseContOnError();
     }
 
     public void exec() {
         try {
-		parser.setInteractive(false);
-		parser.parseStopOnError();
+        parser.setInteractive(false);
+        parser.parseStopOnError();
         } catch (Throwable e) {
             System.err.println(e.getMessage());
-	}
-	
+    }
+    
     }
 }

Modified: incubator/pig/trunk/src/org/apache/pig/tools/grunt/GruntParser.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/src/org/apache/pig/tools/grunt/GruntParser.java?rev=619213&r1=619212&r2=619213&view=diff
==============================================================================
--- incubator/pig/trunk/src/org/apache/pig/tools/grunt/GruntParser.java (original)
+++ incubator/pig/trunk/src/org/apache/pig/tools/grunt/GruntParser.java Wed Feb  6 15:09:43 2008
@@ -31,419 +31,419 @@
 
 
     public GruntParser(Reader stream) {
-		super(stream);
-		init();
+        super(stream);
+        init();
     }
 
-	public GruntParser(InputStream stream, String encoding) {
-		super(stream, encoding);
-		init();
-	}
-
-	public GruntParser(InputStream stream) {
-		super(stream);
-		init();
-	}
-
-	public GruntParser(PigScriptParserTokenManager tm) {
-		super(tm);
-		init();
-	}
-
-	private void init() {
-		// nothing, for now.
-	}
-	
-	public void parseStopOnError() throws IOException, ParseException
-	{
-		prompt();
-		mDone = false;
-		while(!mDone)
-			parse();
-	}
-
-	public void parseContOnError()
-	{
-		prompt();
-		mDone = false;
-		while(!mDone)
-			try
-			{
-				parse();
-			}
-			catch(Exception e)
-			{
-				System.err.println(e.getMessage());
-			}
-	}
-
-	public void setParams(PigServer pigServer)
-	{
-		mPigServer = pigServer;
-		
-		mDfs = mPigServer.getPigContext().getDfs();
-		mLfs = mPigServer.getPigContext().getLfs();
-		mConf = mPigServer.getPigContext().getConf();
-		
-		// TODO: this violates the abstraction layer decoupling between
-		// front end and back end and needs to be changed.
-		// Right now I am not clear on how the Job Id comes from to tell
-		// the back end to kill a given job (mJobClient is used only in 
-		// processKill)
-		//
-		ExecutionEngine execEngine = mPigServer.getPigContext().getExecutionEngine();
-		if (execEngine instanceof HExecutionEngine) {
-			mJobClient = ((HExecutionEngine)execEngine).getJobClient();
-		}
-		else {
-			mJobClient = null;
-		}
-	}
-
-	public void prompt()
-	{
-		if (mInteractive)
-		{
-			System.err.print("grunt> ");
-			System.err.flush();
-		}
-	}
-	
-	protected void quit()
-	{
-		mDone = true;
-	}
-	
-	protected void processRegisterFunc(String name, String expr) {
-		mPigServer.registerFunction(name, expr);
-	}
-	
-	protected void processDescribe(String alias) throws IOException {
-		mPigServer.dumpSchema(alias);
-	}
+    public GruntParser(InputStream stream, String encoding) {
+        super(stream, encoding);
+        init();
+    }
+
+    public GruntParser(InputStream stream) {
+        super(stream);
+        init();
+    }
+
+    public GruntParser(PigScriptParserTokenManager tm) {
+        super(tm);
+        init();
+    }
+
+    private void init() {
+        // nothing, for now.
+    }
+    
+    public void parseStopOnError() throws IOException, ParseException
+    {
+        prompt();
+        mDone = false;
+        while(!mDone)
+            parse();
+    }
+
+    public void parseContOnError()
+    {
+        prompt();
+        mDone = false;
+        while(!mDone)
+            try
+            {
+                parse();
+            }
+            catch(Exception e)
+            {
+                System.err.println(e.getMessage());
+            }
+    }
+
+    public void setParams(PigServer pigServer)
+    {
+        mPigServer = pigServer;
+        
+        mDfs = mPigServer.getPigContext().getDfs();
+        mLfs = mPigServer.getPigContext().getLfs();
+        mConf = mPigServer.getPigContext().getConf();
+        
+        // TODO: this violates the abstraction layer decoupling between
+        // front end and back end and needs to be changed.
+        // Right now I am not clear on how the Job Id comes from to tell
+        // the back end to kill a given job (mJobClient is used only in 
+        // processKill)
+        //
+        ExecutionEngine execEngine = mPigServer.getPigContext().getExecutionEngine();
+        if (execEngine instanceof HExecutionEngine) {
+            mJobClient = ((HExecutionEngine)execEngine).getJobClient();
+        }
+        else {
+            mJobClient = null;
+        }
+    }
+
+    public void prompt()
+    {
+        if (mInteractive)
+        {
+            System.err.print("grunt> ");
+            System.err.flush();
+        }
+    }
+    
+    protected void quit()
+    {
+        mDone = true;
+    }
+    
+    protected void processRegisterFunc(String name, String expr) {
+        mPigServer.registerFunction(name, expr);
+    }
+    
+    protected void processDescribe(String alias) throws IOException {
+        mPigServer.dumpSchema(alias);
+    }
 
     protected void processExplain(String alias) throws IOException {
         mPigServer.explain(alias, System.out);
     }
-	
-	protected void processRegister(String jar) throws IOException {
-		mPigServer.registerJar(jar);
-	}
-
-	protected void processSet(String key, String value) throws IOException, ParseException {
-		if (key.equals("debug"))
-		{
-			if (value.equals("on") || value.equals("'on'"))
-				mPigServer.debugOn();
-			else if (value.equals("off") || value.equals("'off'"))
-				mPigServer.debugOff();
-			else
-				throw new ParseException("Invalid value " + value + " provided for " + key);
-		}
-		else if (key.equals("job.name"))
-		{
-			//mPigServer.setJobName(unquote(value));
-			mPigServer.setJobName(value);
-		}
-		else
-		{
-			// other key-value pairs can go there
-			// for now just throw exception since we don't support
-			// anything else
-			throw new ParseException("Unrecognized set key: " + key);
-		}
-	}
-	
-	protected void processStore(String alias, String file, String func) throws IOException {
-		mPigServer.store(alias, file, func);
-	}
-		
-	protected void processCat(String path) throws IOException
-	{
-		try {
-			byte buffer[] = new byte[65536];
-			ElementDescriptor dfsPath = mDfs.asElement(path);
-			int rc;
-			
-			if (!dfsPath.exists())
-				throw new IOException("Directory " + path + " does not exist.");
-	
-			if (mDfs.isContainer(path)) {
-				ContainerDescriptor dfsDir = (ContainerDescriptor) dfsPath;
-				Iterator<ElementDescriptor> paths = dfsDir.iterator();
-				
-				while (paths.hasNext()) {
-					ElementDescriptor curElem = paths.next();
-					
-					if (mDfs.isContainer(curElem.toString())) {
-						continue;
-					}
-					
-					InputStream is = curElem.open();
-					while ((rc = is.read(buffer)) > 0) {
-						System.out.write(buffer, 0, rc);
-					}
-					is.close();				
-				}
-			}
-			else {
-				InputStream is = dfsPath.open();
-				while ((rc = is.read(buffer)) > 0) {
-					System.out.write(buffer, 0, rc);
-				}
-				is.close();			
-			}
-		}
-		catch (DataStorageException e) {
-			IOException ioe = new IOException("Failed to Cat: " + path);
-			ioe.initCause(e);
-			throw ioe; 
-		}
-	}
-
-	protected void processCD(String path) throws IOException
-	{	
-		ContainerDescriptor container;
-
-		try {
-			if (path == null) {
-				container = mDfs.asContainer("/user/" + System.getProperty("user.name"));
-				mDfs.setActiveContainer(container);
-			}
-			else
-			{
-				container = mDfs.asContainer(path);
-	
-				if (!container.exists()) {
-					throw new IOException("Directory " + path + " does not exist.");
-				}
-				
-				if (!mDfs.isContainer(path)) {
-					throw new IOException(path + " is not a directory.");
-				}
-				
-				mDfs.setActiveContainer(container);
-			}
-		}
-		catch (DataStorageException e) {
-			IOException ioe = new IOException("Failed to change working directory to " + 
-								  ((path == null) ? ("/user/" + System.getProperty("user.name")) 
-									       	      : (path)));
-			ioe.initCause(e);
-			throw ioe;
-		}
-	}
-
-	protected void processDump(String alias) throws IOException
-	{
-		Iterator result = mPigServer.openIterator(alias);
-		while (result.hasNext())
-		{
-			Tuple t = (Tuple) result.next();
-			System.out.println(t);
-		}
-	}
-
-	protected void processKill(String jobid) throws IOException
-	{
-		if (mJobClient != null) {
-			RunningJob job = mJobClient.getJob(jobid);
-			if (job == null)
-				System.out.println("Job with id " + jobid + " is not active");
-			else
-			{	
-				job.killJob();
-				System.err.println("kill submited.");
-			}
-		}
-	}
-		
-	protected void processLS(String path) throws IOException
-	{
-		try {
-			ElementDescriptor pathDescriptor;
-			
-			if (path == null) {
-				pathDescriptor = mDfs.getActiveContainer();
-			}
-			else {
-				pathDescriptor = mDfs.asElement(path);
-			}
-
-			if (!pathDescriptor.exists()) {
-				throw new IOException("File or directory " + path + " does not exist.");				
-			}
-			
-			if (mDfs.isContainer(pathDescriptor.toString())) {
-				ContainerDescriptor container = (ContainerDescriptor) pathDescriptor;
-				Iterator<ElementDescriptor> elems = container.iterator();
-				
-				while (elems.hasNext()) {
-					ElementDescriptor curElem = elems.next();
-					
-					if (mDfs.isContainer(curElem.toString())) {
-		           		System.out.println(curElem.toString() + "\t<dir>");						
-					}
-					else {
-						Properties config = curElem.getConfiguration();
-						Map<String, Object> stats = curElem.getStatistics();
-						
-						String strReplication = config.getProperty(ElementDescriptor.BLOCK_REPLICATION_KEY);
-						String strLen = (String) stats.get(ElementDescriptor.LENGTH_KEY);
-
-						System.out.println(curElem.toString() + "<r " + strReplication + ">\t" + strLen);
-					}
-				}
-			}
-			else {
-				Properties config = pathDescriptor.getConfiguration();
-				Map<String, Object> stats = pathDescriptor.getStatistics();
-
-				String strReplication = (String) config.get(ElementDescriptor.BLOCK_REPLICATION_KEY);
-				String strLen = (String) stats.get(ElementDescriptor.LENGTH_KEY);
-
-				System.out.println(pathDescriptor.toString() + "<r " + strReplication + ">\t" + strLen);				
-			}
-		}
-		catch (DataStorageException e) {
-			IOException ioe = new IOException("Failed to LS on " + path);
-			ioe.initCause(e);
-			throw ioe;
-		}
-	}
-	
-	protected void processPWD() throws IOException 
-	{
-		System.out.println(mDfs.getActiveContainer().toString());
-	}
-
-	protected void printHelp() 
-	{
-		System.err.println("Commands:");
-		System.err.println("<pig latin statement>;");
-		System.err.println("store <alias> into <filename> [using <functionSpec>]");
-		System.err.println("dump <alias>");
-		System.err.println("describe <alias>");
-		System.err.println("kill <job_id>");
-		System.err.println("ls <path>\r\ndu <path>\r\nmv <src> <dst>\r\ncp <src> <dst>\r\nrm <src>");
-		System.err.println("copyFromLocal <localsrc> <dst>\r\ncd <dir>\r\npwd");
-		System.err.println("cat <src>\r\ncopyToLocal <src> <localdst>\r\nmkdir <path>");
-		System.err.println("cd <path>");
-		System.err.println("define <functionAlias> <functionSpec>");
-		System.err.println("register <udfJar>");
-		System.err.println("set key value");
-		System.err.println("quit");
-	}
-
-	protected void processMove(String src, String dst) throws IOException
-	{
-		try {
-			ElementDescriptor srcPath = mDfs.asElement(src);
-			ElementDescriptor dstPath = mDfs.asElement(dst);
-			
-			if (!srcPath.exists()) {
-				throw new IOException("File or directory " + src + " does not exist.");				
-			}
-			
-			srcPath.rename(dstPath);
-		}
-		catch (DataStorageException e) {
-			IOException ioe = new IOException("Failed to move " + src + " to " + dst);
-			ioe.initCause(e);
-			throw ioe;		
-		}
-	}
-	
-	protected void processCopy(String src, String dst) throws IOException
-	{
-		try {
-			ElementDescriptor srcPath = mDfs.asElement(src);
-			ElementDescriptor dstPath = mDfs.asElement(dst);
-			
-			srcPath.copy(dstPath, mConf, false);
-		}
-		catch (DataStorageException e) {
-			IOException ioe = new IOException("Failed to copy " + src + " to " + dst);
-			ioe.initCause(e);
-			throw ioe;
-		}
-	}
-	
-	protected void processCopyToLocal(String src, String dst) throws IOException
-	{
-		try {
-			ElementDescriptor srcPath = mDfs.asElement(src);
-			ElementDescriptor dstPath = mLfs.asElement(dst);
-			
-			srcPath.copy(dstPath, false);
-		}
-		catch (DataStorageException e) {
-			IOException ioe = new IOException("Failed to copy " + src + "to (locally) " + dst);
-			ioe.initCause(e);
-			throw ioe;
-		}
-	}
-
-	protected void processCopyFromLocal(String src, String dst) throws IOException
-	{
-		try {
-			ElementDescriptor srcPath = mLfs.asElement(src);
-			ElementDescriptor dstPath = mDfs.asElement(dst);
-			
-			srcPath.copy(dstPath, false);
-		}
-		catch (DataStorageException e) {
-			IOException ioe = new IOException("Failed to copy (loally) " + src + "to " + dst);
-			ioe.initCause(e);
-			throw ioe;
-		}
-	}
-	
-	protected void processMkdir(String dir) throws IOException
-	{
-		try {
-			ContainerDescriptor dirDescriptor = mDfs.asContainer(dir);
-			
-			dirDescriptor.create();
-		}
-		catch (DataStorageException e) {
-			IOException ioe = new IOException("Failed to create dir: " + dir);
-			ioe.initCause(e);
-			throw ioe;
-		}
-	}
-	
-	protected void processPig(String cmd) throws IOException
-	{
-		if (cmd.charAt(cmd.length() - 1) != ';') 
-			mPigServer.registerQuery(cmd + ";"); 
-		else 
-			mPigServer.registerQuery(cmd);
-	}
-
-	protected void processRemove(String path) throws IOException
-	{
-		try {
-			ElementDescriptor dfsPath = mDfs.asElement(path);
-		
-			if (!dfsPath.exists()) {
-				throw new IOException("File or directory " + path + " does not exist.");			
-			}
-			
-			dfsPath.delete();
-		}
-		catch (DataStorageException e) {
-			IOException ioe = new IOException("Failed to get descriptor for " + path);
-			ioe.initCause(e);
-			throw ioe;
-		}
-	}
-
-	private PigServer mPigServer;
-	private DataStorage mDfs;
-	private DataStorage mLfs;
-	private Properties mConf;
-	private JobClient mJobClient;
-	private boolean mDone;
+    
+    protected void processRegister(String jar) throws IOException {
+        mPigServer.registerJar(jar);
+    }
+
+    protected void processSet(String key, String value) throws IOException, ParseException {
+        if (key.equals("debug"))
+        {
+            if (value.equals("on") || value.equals("'on'"))
+                mPigServer.debugOn();
+            else if (value.equals("off") || value.equals("'off'"))
+                mPigServer.debugOff();
+            else
+                throw new ParseException("Invalid value " + value + " provided for " + key);
+        }
+        else if (key.equals("job.name"))
+        {
+            //mPigServer.setJobName(unquote(value));
+            mPigServer.setJobName(value);
+        }
+        else
+        {
+            // other key-value pairs can go there
+            // for now just throw exception since we don't support
+            // anything else
+            throw new ParseException("Unrecognized set key: " + key);
+        }
+    }
+    
+    protected void processStore(String alias, String file, String func) throws IOException {
+        mPigServer.store(alias, file, func);
+    }
+        
+    protected void processCat(String path) throws IOException
+    {
+        try {
+            byte buffer[] = new byte[65536];
+            ElementDescriptor dfsPath = mDfs.asElement(path);
+            int rc;
+            
+            if (!dfsPath.exists())
+                throw new IOException("Directory " + path + " does not exist.");
+    
+            if (mDfs.isContainer(path)) {
+                ContainerDescriptor dfsDir = (ContainerDescriptor) dfsPath;
+                Iterator<ElementDescriptor> paths = dfsDir.iterator();
+                
+                while (paths.hasNext()) {
+                    ElementDescriptor curElem = paths.next();
+                    
+                    if (mDfs.isContainer(curElem.toString())) {
+                        continue;
+                    }
+                    
+                    InputStream is = curElem.open();
+                    while ((rc = is.read(buffer)) > 0) {
+                        System.out.write(buffer, 0, rc);
+                    }
+                    is.close();                
+                }
+            }
+            else {
+                InputStream is = dfsPath.open();
+                while ((rc = is.read(buffer)) > 0) {
+                    System.out.write(buffer, 0, rc);
+                }
+                is.close();            
+            }
+        }
+        catch (DataStorageException e) {
+            IOException ioe = new IOException("Failed to Cat: " + path);
+            ioe.initCause(e);
+            throw ioe; 
+        }
+    }
+
+    protected void processCD(String path) throws IOException
+    {    
+        ContainerDescriptor container;
+
+        try {
+            if (path == null) {
+                container = mDfs.asContainer("/user/" + System.getProperty("user.name"));
+                mDfs.setActiveContainer(container);
+            }
+            else
+            {
+                container = mDfs.asContainer(path);
+    
+                if (!container.exists()) {
+                    throw new IOException("Directory " + path + " does not exist.");
+                }
+                
+                if (!mDfs.isContainer(path)) {
+                    throw new IOException(path + " is not a directory.");
+                }
+                
+                mDfs.setActiveContainer(container);
+            }
+        }
+        catch (DataStorageException e) {
+            IOException ioe = new IOException("Failed to change working directory to " + 
+                                  ((path == null) ? ("/user/" + System.getProperty("user.name")) 
+                                                     : (path)));
+            ioe.initCause(e);
+            throw ioe;
+        }
+    }
+
+    protected void processDump(String alias) throws IOException
+    {
+        Iterator result = mPigServer.openIterator(alias);
+        while (result.hasNext())
+        {
+            Tuple t = (Tuple) result.next();
+            System.out.println(t);
+        }
+    }
+
+    protected void processKill(String jobid) throws IOException
+    {
+        if (mJobClient != null) {
+            RunningJob job = mJobClient.getJob(jobid);
+            if (job == null)
+                System.out.println("Job with id " + jobid + " is not active");
+            else
+            {    
+                job.killJob();
+                System.err.println("kill submited.");
+            }
+        }
+    }
+        
+    protected void processLS(String path) throws IOException
+    {
+        try {
+            ElementDescriptor pathDescriptor;
+            
+            if (path == null) {
+                pathDescriptor = mDfs.getActiveContainer();
+            }
+            else {
+                pathDescriptor = mDfs.asElement(path);
+            }
+
+            if (!pathDescriptor.exists()) {
+                throw new IOException("File or directory " + path + " does not exist.");                
+            }
+            
+            if (mDfs.isContainer(pathDescriptor.toString())) {
+                ContainerDescriptor container = (ContainerDescriptor) pathDescriptor;
+                Iterator<ElementDescriptor> elems = container.iterator();
+                
+                while (elems.hasNext()) {
+                    ElementDescriptor curElem = elems.next();
+                    
+                    if (mDfs.isContainer(curElem.toString())) {
+                           System.out.println(curElem.toString() + "\t<dir>");                        
+                    }
+                    else {
+                        Properties config = curElem.getConfiguration();
+                        Map<String, Object> stats = curElem.getStatistics();
+                        
+                        String strReplication = config.getProperty(ElementDescriptor.BLOCK_REPLICATION_KEY);
+                        String strLen = (String) stats.get(ElementDescriptor.LENGTH_KEY);
+
+                        System.out.println(curElem.toString() + "<r " + strReplication + ">\t" + strLen);
+                    }
+                }
+            }
+            else {
+                Properties config = pathDescriptor.getConfiguration();
+                Map<String, Object> stats = pathDescriptor.getStatistics();
+
+                String strReplication = (String) config.get(ElementDescriptor.BLOCK_REPLICATION_KEY);
+                String strLen = (String) stats.get(ElementDescriptor.LENGTH_KEY);
+
+                System.out.println(pathDescriptor.toString() + "<r " + strReplication + ">\t" + strLen);                
+            }
+        }
+        catch (DataStorageException e) {
+            IOException ioe = new IOException("Failed to LS on " + path);
+            ioe.initCause(e);
+            throw ioe;
+        }
+    }
+    
+    protected void processPWD() throws IOException 
+    {
+        System.out.println(mDfs.getActiveContainer().toString());
+    }
+
+    protected void printHelp() 
+    {
+        System.err.println("Commands:");
+        System.err.println("<pig latin statement>;");
+        System.err.println("store <alias> into <filename> [using <functionSpec>]");
+        System.err.println("dump <alias>");
+        System.err.println("describe <alias>");
+        System.err.println("kill <job_id>");
+        System.err.println("ls <path>\r\ndu <path>\r\nmv <src> <dst>\r\ncp <src> <dst>\r\nrm <src>");
+        System.err.println("copyFromLocal <localsrc> <dst>\r\ncd <dir>\r\npwd");
+        System.err.println("cat <src>\r\ncopyToLocal <src> <localdst>\r\nmkdir <path>");
+        System.err.println("cd <path>");
+        System.err.println("define <functionAlias> <functionSpec>");
+        System.err.println("register <udfJar>");
+        System.err.println("set key value");
+        System.err.println("quit");
+    }
+
+    protected void processMove(String src, String dst) throws IOException
+    {
+        try {
+            ElementDescriptor srcPath = mDfs.asElement(src);
+            ElementDescriptor dstPath = mDfs.asElement(dst);
+            
+            if (!srcPath.exists()) {
+                throw new IOException("File or directory " + src + " does not exist.");                
+            }
+            
+            srcPath.rename(dstPath);
+        }
+        catch (DataStorageException e) {
+            IOException ioe = new IOException("Failed to move " + src + " to " + dst);
+            ioe.initCause(e);
+            throw ioe;        
+        }
+    }
+    
+    protected void processCopy(String src, String dst) throws IOException
+    {
+        try {
+            ElementDescriptor srcPath = mDfs.asElement(src);
+            ElementDescriptor dstPath = mDfs.asElement(dst);
+            
+            srcPath.copy(dstPath, mConf, false);
+        }
+        catch (DataStorageException e) {
+            IOException ioe = new IOException("Failed to copy " + src + " to " + dst);
+            ioe.initCause(e);
+            throw ioe;
+        }
+    }
+    
+    protected void processCopyToLocal(String src, String dst) throws IOException
+    {
+        try {
+            ElementDescriptor srcPath = mDfs.asElement(src);
+            ElementDescriptor dstPath = mLfs.asElement(dst);
+            
+            srcPath.copy(dstPath, false);
+        }
+        catch (DataStorageException e) {
+            IOException ioe = new IOException("Failed to copy " + src + "to (locally) " + dst);
+            ioe.initCause(e);
+            throw ioe;
+        }
+    }
+
+    protected void processCopyFromLocal(String src, String dst) throws IOException
+    {
+        try {
+            ElementDescriptor srcPath = mLfs.asElement(src);
+            ElementDescriptor dstPath = mDfs.asElement(dst);
+            
+            srcPath.copy(dstPath, false);
+        }
+        catch (DataStorageException e) {
+            IOException ioe = new IOException("Failed to copy (loally) " + src + "to " + dst);
+            ioe.initCause(e);
+            throw ioe;
+        }
+    }
+    
+    protected void processMkdir(String dir) throws IOException
+    {
+        try {
+            ContainerDescriptor dirDescriptor = mDfs.asContainer(dir);
+            
+            dirDescriptor.create();
+        }
+        catch (DataStorageException e) {
+            IOException ioe = new IOException("Failed to create dir: " + dir);
+            ioe.initCause(e);
+            throw ioe;
+        }
+    }
+    
+    protected void processPig(String cmd) throws IOException
+    {
+        if (cmd.charAt(cmd.length() - 1) != ';') 
+            mPigServer.registerQuery(cmd + ";"); 
+        else 
+            mPigServer.registerQuery(cmd);
+    }
+
+    protected void processRemove(String path) throws IOException
+    {
+        try {
+            ElementDescriptor dfsPath = mDfs.asElement(path);
+        
+            if (!dfsPath.exists()) {
+                throw new IOException("File or directory " + path + " does not exist.");            
+            }
+            
+            dfsPath.delete();
+        }
+        catch (DataStorageException e) {
+            IOException ioe = new IOException("Failed to get descriptor for " + path);
+            ioe.initCause(e);
+            throw ioe;
+        }
+    }
+
+    private PigServer mPigServer;
+    private DataStorage mDfs;
+    private DataStorage mLfs;
+    private Properties mConf;
+    private JobClient mJobClient;
+    private boolean mDone;
 
 }

Modified: incubator/pig/trunk/src/org/apache/pig/tools/streams/StreamGenerator.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/src/org/apache/pig/tools/streams/StreamGenerator.java?rev=619213&r1=619212&r2=619213&view=diff
==============================================================================
--- incubator/pig/trunk/src/org/apache/pig/tools/streams/StreamGenerator.java (original)
+++ incubator/pig/trunk/src/org/apache/pig/tools/streams/StreamGenerator.java Wed Feb  6 15:09:43 2008
@@ -96,42 +96,42 @@
     public void actionPerformed(ActionEvent event) {
         
         if (out == null){
-        	
-        	try{
-        		String fileName = fileField.getText();
+            
+            try{
+                String fileName = fileField.getText();
                 String format = formatField.getText();
-        		out = new PrintWriter(fileName);
-        		String[] formats = format.split(",");
-        		this.formats = new int[formats.length];
-        		for (int i=0; i<formats.length; i++){
-        			this.formats[i] = (int)Math.pow(10,Integer.parseInt(formats[i]));
-        		}
-        	}catch(Exception e){
-        		new Dialog(generatorFrame,"Input not well formed");
-        	}
-        	
-        	//First time
-        	fileField.setEditable(false);
-        	formatField.setEditable(false);
+                out = new PrintWriter(fileName);
+                String[] formats = format.split(",");
+                this.formats = new int[formats.length];
+                for (int i=0; i<formats.length; i++){
+                    this.formats[i] = (int)Math.pow(10,Integer.parseInt(formats[i]));
+                }
+            }catch(Exception e){
+                new Dialog(generatorFrame,"Input not well formed");
+            }
+            
+            //First time
+            fileField.setEditable(false);
+            formatField.setEditable(false);
 
         }
 
         int numTuples=0;
         
         try{
-        	numTuples = Integer.parseInt(numberField.getText()); 
+            numTuples = Integer.parseInt(numberField.getText()); 
         }catch(Exception e){
-    		new Dialog(generatorFrame,"Input not well formed");
-    	}
+            new Dialog(generatorFrame,"Input not well formed");
+        }
 
         for (int i=0; i<numTuples; i++){
-        	for (int j=0; j<formats.length; j++){
-        		out.print(random.nextInt(formats[j]));
-        		if (j==formats.length-1)
-        			out.println("");
-        		else
-        			out.print("\t");
-        	}
+            for (int j=0; j<formats.length; j++){
+                out.print(random.nextInt(formats[j]));
+                if (j==formats.length-1)
+                    out.println("");
+                else
+                    out.print("\t");
+            }
         }
         
         out.flush();

Modified: incubator/pig/trunk/src/org/apache/pig/tools/timer/PerformanceTimer.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/src/org/apache/pig/tools/timer/PerformanceTimer.java?rev=619213&r1=619212&r2=619213&view=diff
==============================================================================
--- incubator/pig/trunk/src/org/apache/pig/tools/timer/PerformanceTimer.java (original)
+++ incubator/pig/trunk/src/org/apache/pig/tools/timer/PerformanceTimer.java Wed Feb  6 15:09:43 2008
@@ -34,9 +34,9 @@
  */
 public void start()
 {
-	mStartedAt = System.nanoTime();
-	mStarts++;
-	mState = State.RUNNING;
+    mStartedAt = System.nanoTime();
+    mStarts++;
+    mState = State.RUNNING;
 }
 
 /**
@@ -44,8 +44,8 @@
  */
 public void stop()
 {
-	mState = State.STOPPED;
-	mNanosecs += System.nanoTime() - mStartedAt;
+    mState = State.STOPPED;
+    mNanosecs += System.nanoTime() - mStartedAt;
 }
 
 /**
@@ -55,22 +55,22 @@
  */
 public void print(PrintStream out)
 {
-	if (mStarts == 0) {
-		out.println(mName + " never started.");
-		return;
-	}
-	
-	if (mState == State.RUNNING) out.print("WARNING:  timer still running!  ");
-	out.print(mName + ": ");
-	double t = mNanosecs / 1000000000.0;
-	out.print(t);
-	out.print(".  Run ");
-	out.print(mStarts);
-	out.print(" times, average run time ");
-	long avg = mNanosecs / mStarts;
-	t = avg / 1000000000.0;
-	out.print(t);
-	out.println(".");
+    if (mStarts == 0) {
+        out.println(mName + " never started.");
+        return;
+    }
+    
+    if (mState == State.RUNNING) out.print("WARNING:  timer still running!  ");
+    out.print(mName + ": ");
+    double t = mNanosecs / 1000000000.0;
+    out.print(t);
+    out.print(".  Run ");
+    out.print(mStarts);
+    out.print(" times, average run time ");
+    long avg = mNanosecs / mStarts;
+    t = avg / 1000000000.0;
+    out.print(t);
+    out.println(".");
 }
 
 /**
@@ -78,10 +78,10 @@
  */
 PerformanceTimer(String name)
 {
-	mNanosecs = 0;
-	mStarts = 0;
-	mName = name;
-	mState = State.STOPPED;
+    mNanosecs = 0;
+    mStarts = 0;
+    mName = name;
+    mState = State.STOPPED;
 }
 
 

Modified: incubator/pig/trunk/src/org/apache/pig/tools/timer/PerformanceTimerFactory.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/src/org/apache/pig/tools/timer/PerformanceTimerFactory.java?rev=619213&r1=619212&r2=619213&view=diff
==============================================================================
--- incubator/pig/trunk/src/org/apache/pig/tools/timer/PerformanceTimerFactory.java (original)
+++ incubator/pig/trunk/src/org/apache/pig/tools/timer/PerformanceTimerFactory.java Wed Feb  6 15:09:43 2008
@@ -42,10 +42,10 @@
  */
 public static PerformanceTimerFactory getPerfTimerFactory()
 {
-	if (self == null) {
-		self = new PerformanceTimerFactory();
-	}
-	return self;
+    if (self == null) {
+        self = new PerformanceTimerFactory();
+    }
+    return self;
 }
 
 /**
@@ -56,12 +56,12 @@
  */
 public PerformanceTimer getTimer(String name)
 {
-	PerformanceTimer timer = mTimers.get(name);
-	if (timer == null) {
-		timer = new PerformanceTimer(name);
-		mTimers.put(name, timer);
-	} 
-	return timer;
+    PerformanceTimer timer = mTimers.get(name);
+    if (timer == null) {
+        timer = new PerformanceTimer(name);
+        mTimers.put(name, timer);
+    } 
+    return timer;
 }
 
 /**
@@ -70,23 +70,23 @@
  */
 public void dumpTimers(PrintStream out)
 {
-	Collection<PerformanceTimer> c = mTimers.values();
-	Iterator<PerformanceTimer> i = c.iterator();
-	while (i.hasNext()) {
-		i.next().print(out);
-	}
+    Collection<PerformanceTimer> c = mTimers.values();
+    Iterator<PerformanceTimer> i = c.iterator();
+    while (i.hasNext()) {
+        i.next().print(out);
+    }
 }
 
 public void dumpTimers()
 {
-	dumpTimers(System.out);
+    dumpTimers(System.out);
 }
 
 private static PerformanceTimerFactory self = null;
 
 private PerformanceTimerFactory()
 {
-	mTimers = new HashMap<String, PerformanceTimer>();
+    mTimers = new HashMap<String, PerformanceTimer>();
 }
 
 HashMap<String, PerformanceTimer> mTimers;