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/04/25 18:57:16 UTC
svn commit: r651650 - in /incubator/pig/branches/types: ./
src/org/apache/pig/builtin/ src/org/apache/pig/data/
src/org/apache/pig/impl/logicalLayer/
src/org/apache/pig/impl/physicalLayer/plans/
src/org/apache/pig/impl/physicalLayer/topLevelOperators/ ...
Author: gates
Date: Fri Apr 25 09:57:13 2008
New Revision: 651650
URL: http://svn.apache.org/viewvc?rev=651650&view=rev
Log:
Reworked exceptions to remove use of IOException (except where we really are hitting an IO issue) in code the pipeline rework has reworked.
Added:
incubator/pig/branches/types/src/org/apache/pig/impl/plan/PlanException.java
Modified:
incubator/pig/branches/types/build.xml
incubator/pig/branches/types/src/org/apache/pig/builtin/AVG.java
incubator/pig/branches/types/src/org/apache/pig/builtin/BinStorage.java
incubator/pig/branches/types/src/org/apache/pig/builtin/COUNT.java
incubator/pig/branches/types/src/org/apache/pig/builtin/DIFF.java
incubator/pig/branches/types/src/org/apache/pig/builtin/IsEmpty.java
incubator/pig/branches/types/src/org/apache/pig/builtin/MAX.java
incubator/pig/branches/types/src/org/apache/pig/builtin/MIN.java
incubator/pig/branches/types/src/org/apache/pig/builtin/PigStorage.java
incubator/pig/branches/types/src/org/apache/pig/builtin/SUM.java
incubator/pig/branches/types/src/org/apache/pig/builtin/TOKENIZE.java
incubator/pig/branches/types/src/org/apache/pig/data/DataReaderWriter.java
incubator/pig/branches/types/src/org/apache/pig/data/DataType.java
incubator/pig/branches/types/src/org/apache/pig/data/DefaultAbstractBag.java
incubator/pig/branches/types/src/org/apache/pig/data/DefaultTuple.java
incubator/pig/branches/types/src/org/apache/pig/data/DefaultTupleFactory.java
incubator/pig/branches/types/src/org/apache/pig/data/Tuple.java
incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOBinCond.java
incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOCogroup.java
incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LODistinct.java
incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOFilter.java
incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOForEach.java
incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOGenerate.java
incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOLoad.java
incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOSort.java
incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOSplit.java
incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LogicalOperator.java
incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/plans/PhysicalPlan.java
incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/POGenerate.java
incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/POPackage.java
incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/expressionOperators/POProject.java
incubator/pig/branches/types/src/org/apache/pig/impl/plan/OperatorPlan.java
incubator/pig/branches/types/test/org/apache/pig/test/TestOperatorPlan.java
incubator/pig/branches/types/test/org/apache/pig/test/Util.java
incubator/pig/branches/types/test/org/apache/pig/test/utils/GenPhyOp.java
incubator/pig/branches/types/test/org/apache/pig/test/utils/TestHelper.java
Modified: incubator/pig/branches/types/build.xml
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/build.xml?rev=651650&r1=651649&r2=651650&view=diff
==============================================================================
--- incubator/pig/branches/types/build.xml (original)
+++ incubator/pig/branches/types/build.xml Fri Apr 25 09:57:13 2008
@@ -148,7 +148,8 @@
**/logicalLayer/schema/*.java, **/physicalLayer/topLevelOperators/*.java,
**/physicalLayer/topLevelOperators/**/*.java, **/physicalLayer/plans/*.java,
**/physicalLayer/Result.java,
- **/physicalLayer/POStatus.java, **/bzip2r/*.java"
+ **/physicalLayer/POStatus.java, **/bzip2r/*.java,
+ **/backend/executionengine/ExecException.java"
destdir="${dist}" debug="${javac.debug}" optimize="${javac.optimize}" target="${javac.version}" source="${javac.version}" deprecation="${javac.deprecation}">
<compilerarg line="${javac.args} ${javac.args.warnings}" />
<classpath refid="${cp}" />
Modified: incubator/pig/branches/types/src/org/apache/pig/builtin/AVG.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/builtin/AVG.java?rev=651650&r1=651649&r2=651650&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/builtin/AVG.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/builtin/AVG.java Fri Apr 25 09:57:13 2008
@@ -27,6 +27,7 @@
import org.apache.pig.data.Tuple;
import org.apache.pig.data.TupleFactory;
import org.apache.pig.impl.logicalLayer.schema.Schema;
+import org.apache.pig.backend.executionengine.ExecException;
/**
@@ -39,14 +40,20 @@
@Override
public Double exec(Tuple input) throws IOException {
- double sum = sum(input);
- double count = count(input);
+ try {
+ double sum = sum(input);
+ double count = count(input);
- double avg = 0;
- if (count > 0)
- avg = sum / count;
-
- return new Double(avg);
+ double avg = 0;
+ if (count > 0)
+ avg = sum / count;
+
+ return new Double(avg);
+ } catch (ExecException ee) {
+ IOException oughtToBeEE = new IOException();
+ ee.initCause(ee);
+ throw oughtToBeEE;
+ }
}
public String getInitial() {
@@ -71,36 +78,53 @@
return t;
} catch(RuntimeException t) {
throw new RuntimeException(t.getMessage() + ": " + input);
+ } catch (ExecException ee) {
+ IOException oughtToBeEE = new IOException();
+ ee.initCause(ee);
+ throw oughtToBeEE;
}
+
}
}
static public class Intermed extends EvalFunc<Tuple> {
@Override
public Tuple exec(Tuple input) throws IOException {
- DataBag b = (DataBag)input.get(0);
- return combine(b);
+ try {
+ DataBag b = (DataBag)input.get(0);
+ return combine(b);
+ } catch (ExecException ee) {
+ IOException oughtToBeEE = new IOException();
+ ee.initCause(ee);
+ throw oughtToBeEE;
+ }
}
}
static public class Final extends EvalFunc<Double> {
@Override
public Double exec(Tuple input) throws IOException {
- DataBag b = (DataBag)input.get(0);
- Tuple combined = combine(b);
+ try {
+ DataBag b = (DataBag)input.get(0);
+ Tuple combined = combine(b);
- double sum = (Double)combined.get(0);
- double count = (Long)combined.get(1);
+ double sum = (Double)combined.get(0);
+ double count = (Long)combined.get(1);
- double avg = 0;
- if (count > 0) {
- avg = sum / count;
+ double avg = 0;
+ if (count > 0) {
+ avg = sum / count;
+ }
+ return new Double(avg);
+ } catch (ExecException ee) {
+ IOException oughtToBeEE = new IOException();
+ ee.initCause(ee);
+ throw oughtToBeEE;
}
- return new Double(avg);
}
}
- static protected Tuple combine(DataBag values) throws IOException {
+ static protected Tuple combine(DataBag values) throws ExecException {
double sum = 0;
long count = 0;
@@ -117,12 +141,12 @@
return output;
}
- static protected long count(Tuple input) throws IOException {
+ static protected long count(Tuple input) throws ExecException {
DataBag values = (DataBag)input.get(0);
return values.size();
}
- static protected double sum(Tuple input) throws IOException {
+ static protected double sum(Tuple input) throws ExecException, IOException {
DataBag values = (DataBag)input.get(0);
double sum = 0;
Modified: incubator/pig/branches/types/src/org/apache/pig/builtin/BinStorage.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/builtin/BinStorage.java?rev=651650&r1=651649&r2=651650&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/builtin/BinStorage.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/builtin/BinStorage.java Fri Apr 25 09:57:13 2008
@@ -28,6 +28,7 @@
import org.apache.pig.LoadFunc;
import org.apache.pig.StoreFunc;
+import org.apache.pig.backend.executionengine.ExecException;
import org.apache.pig.data.DataBag;
import org.apache.pig.data.DataReaderWriter;
import org.apache.pig.data.Tuple;
@@ -76,7 +77,13 @@
if(b == -1) return null;
break;
}
- return (Tuple)DataReaderWriter.readDatum(inData);
+ try {
+ return (Tuple)DataReaderWriter.readDatum(inData);
+ } catch (ExecException ee) {
+ IOException oughtToBeEE = new IOException();
+ ee.initCause(ee);
+ throw oughtToBeEE;
+ }
}
public void bindTo(String fileName, BufferedPositionedInputStream in, long offset, long end) throws IOException {
Modified: incubator/pig/branches/types/src/org/apache/pig/builtin/COUNT.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/builtin/COUNT.java?rev=651650&r1=651649&r2=651650&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/builtin/COUNT.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/builtin/COUNT.java Fri Apr 25 09:57:13 2008
@@ -23,12 +23,12 @@
import org.apache.pig.Algebraic;
import org.apache.pig.EvalFunc;
+import org.apache.pig.backend.executionengine.ExecException;
import org.apache.pig.data.DataBag;
import org.apache.pig.data.DataType;
import org.apache.pig.data.Tuple;
import org.apache.pig.data.TupleFactory;
import org.apache.pig.impl.logicalLayer.schema.Schema;
-import org.apache.pig.impl.util.WrappedIOException;
/**
* Generates the count of the values of the first field of a tuple. This class is Algebraic in
@@ -38,7 +38,13 @@
@Override
public Long exec(Tuple input) throws IOException {
- return count(input);
+ try {
+ return count(input);
+ } catch (ExecException ee) {
+ IOException oughtToBeEE = new IOException();
+ ee.initCause(ee);
+ throw oughtToBeEE;
+ }
}
public String getInitial() {
@@ -58,7 +64,13 @@
@Override
public Tuple exec(Tuple input) throws IOException {
- return tfact.newTuple(count(input));
+ try {
+ return tfact.newTuple(count(input));
+ } catch (ExecException ee) {
+ IOException oughtToBeEE = new IOException();
+ ee.initCause(ee);
+ throw oughtToBeEE;
+ }
}
}
@@ -67,40 +79,48 @@
@Override
public Tuple exec(Tuple input) throws IOException {
- return tfact.newTuple(count(input));
+ try {
+ return tfact.newTuple(count(input));
+ } catch (ExecException ee) {
+ IOException oughtToBeEE = new IOException();
+ ee.initCause(ee);
+ throw oughtToBeEE;
+ }
}
}
static public class Final extends EvalFunc<Long> {
@Override
public Long exec(Tuple input) throws IOException {
- return sum(input);
+ try {
+ return sum(input);
+ } catch (Exception ee) {
+ IOException oughtToBeEE = new IOException();
+ ee.initCause(ee);
+ throw oughtToBeEE;
+ }
}
}
- static protected Long count(Tuple input) throws IOException {
+ static protected Long count(Tuple input) throws ExecException {
Object values = input.get(0);
if (values instanceof DataBag)
return ((DataBag)values).size();
else if (values instanceof Map)
return new Long(((Map)values).size());
else
- throw new IOException("Cannot count a " +
+ throw new ExecException("Cannot count a " +
DataType.findTypeName(values));
}
- static protected Long sum(Tuple input) throws IOException {
+ static protected Long sum(Tuple input) throws ExecException, NumberFormatException {
DataBag values = (DataBag)input.get(0);
long sum = 0;
for (Iterator<Tuple> it = values.iterator(); it.hasNext();) {
Tuple t = it.next();
- try {
- // Have faith here. Checking each value before the cast is
- // just too much.
- sum += (Long)t.get(0);
- } catch (NumberFormatException exp) {
- throw WrappedIOException.wrap(exp.getClass().getName() + ":" + exp.getMessage(), exp);
- }
+ // Have faith here. Checking each value before the cast is
+ // just too much.
+ sum += (Long)t.get(0);
}
return sum;
}
Modified: incubator/pig/branches/types/src/org/apache/pig/builtin/DIFF.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/builtin/DIFF.java?rev=651650&r1=651649&r2=651650&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/builtin/DIFF.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/builtin/DIFF.java Fri Apr 25 09:57:13 2008
@@ -21,6 +21,7 @@
import java.util.Iterator;
import org.apache.pig.EvalFunc;
+import org.apache.pig.backend.executionengine.ExecException;
import org.apache.pig.data.BagFactory;
import org.apache.pig.data.DataBag;
import org.apache.pig.data.Tuple;
@@ -50,27 +51,33 @@
throw new IOException("DIFF must compare two fields not " +
input.size());
}
- DataBag output = mBagFactory.newDefaultBag();
- Object o1 = input.get(0);
- if (o1 instanceof DataBag) {
- DataBag bag1 = (DataBag)o1;
- DataBag bag2 = (DataBag)input.get(1);
- computeDiff(bag1, bag2, output);
- } else {
- Object d1 = input.get(0);
- Object d2 = input.get(1);
- if (!d1.equals(d2)) {
- output.add(mTupleFactory.newTuple(d1));
- output.add(mTupleFactory.newTuple(d2));
+ try {
+ DataBag output = mBagFactory.newDefaultBag();
+ Object o1 = input.get(0);
+ if (o1 instanceof DataBag) {
+ DataBag bag1 = (DataBag)o1;
+ DataBag bag2 = (DataBag)input.get(1);
+ computeDiff(bag1, bag2, output);
+ } else {
+ Object d1 = input.get(0);
+ Object d2 = input.get(1);
+ if (!d1.equals(d2)) {
+ output.add(mTupleFactory.newTuple(d1));
+ output.add(mTupleFactory.newTuple(d2));
+ }
}
+ return output;
+ } catch (ExecException ee) {
+ IOException oughtToBeEE = new IOException();
+ ee.initCause(ee);
+ throw oughtToBeEE;
}
- return output;
}
private void computeDiff(
DataBag bag1,
DataBag bag2,
- DataBag emitTo) throws IOException {
+ DataBag emitTo) {
// Create two distinct versions of the bag. This will speed up
// comparison, and provide us a sorted order so we don't have to do
// an n^2 lookup.
Modified: incubator/pig/branches/types/src/org/apache/pig/builtin/IsEmpty.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/builtin/IsEmpty.java?rev=651650&r1=651649&r2=651650&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/builtin/IsEmpty.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/builtin/IsEmpty.java Fri Apr 25 09:57:13 2008
@@ -21,6 +21,7 @@
import java.util.Map;
import org.apache.pig.FilterFunc;
+import org.apache.pig.backend.executionengine.ExecException;
import org.apache.pig.data.DataBag;
import org.apache.pig.data.Tuple;
import org.apache.pig.data.DataType;
@@ -30,14 +31,20 @@
@Override
public boolean exec(Tuple input) throws IOException {
- Object values = input.get(0);
- if (values instanceof DataBag)
- return ((DataBag)values).size() == 0;
- else if (values instanceof Map)
- return ((Map)values).size() == 0;
- else
- throw new IOException("Cannot test a " +
- DataType.findTypeName(values) + " for emptiness.");
+ try {
+ Object values = input.get(0);
+ if (values instanceof DataBag)
+ return ((DataBag)values).size() == 0;
+ else if (values instanceof Map)
+ return ((Map)values).size() == 0;
+ else
+ throw new IOException("Cannot test a " +
+ DataType.findTypeName(values) + " for emptiness.");
+ } catch (ExecException ee) {
+ IOException oughtToBeEE = new IOException();
+ ee.initCause(ee);
+ throw oughtToBeEE;
+ }
}
}
Modified: incubator/pig/branches/types/src/org/apache/pig/builtin/MAX.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/builtin/MAX.java?rev=651650&r1=651649&r2=651650&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/builtin/MAX.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/builtin/MAX.java Fri Apr 25 09:57:13 2008
@@ -22,6 +22,7 @@
import org.apache.pig.Algebraic;
import org.apache.pig.EvalFunc;
+import org.apache.pig.backend.executionengine.ExecException;
import org.apache.pig.data.DataBag;
import org.apache.pig.data.DataType;
import org.apache.pig.data.Tuple;
@@ -37,7 +38,13 @@
@Override
public Double exec(Tuple input) throws IOException {
- return max(input);
+ try {
+ return max(input);
+ } catch (ExecException ee) {
+ IOException oughtToBeEE = new IOException();
+ ee.initCause(ee);
+ throw oughtToBeEE;
+ }
}
public String getInitial() {
@@ -57,20 +64,32 @@
@Override
public Tuple exec(Tuple input) throws IOException {
- return tfact.newTuple(max(input));
+ try {
+ return tfact.newTuple(max(input));
+ } catch (ExecException ee) {
+ IOException oughtToBeEE = new IOException();
+ ee.initCause(ee);
+ throw oughtToBeEE;
+ }
}
}
static public class Final extends EvalFunc<Double> {
@Override
public Double exec(Tuple input) throws IOException {
- return max(input);
+ try {
+ return max(input);
+ } catch (ExecException ee) {
+ IOException oughtToBeEE = new IOException();
+ ee.initCause(ee);
+ throw oughtToBeEE;
+ }
}
}
- static protected Double max(Tuple input) throws IOException {
+ static protected Double max(Tuple input) throws ExecException {
Object o = input.get(0);
if (!(o instanceof DataBag)) {
- throw new IOException("Input to sum function should be a bag");
+ throw new ExecException("Input to sum function should be a bag");
}
DataBag values = (DataBag)o;
@@ -82,7 +101,7 @@
if (d == null) continue;
curMax = java.lang.Math.max(curMax, d);
} catch (RuntimeException exp) {
- IOException newE = new IOException("Error processing: " +
+ ExecException newE = new ExecException("Error processing: " +
t.toString() + exp.getMessage());
newE.initCause(exp);
throw newE;
Modified: incubator/pig/branches/types/src/org/apache/pig/builtin/MIN.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/builtin/MIN.java?rev=651650&r1=651649&r2=651650&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/builtin/MIN.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/builtin/MIN.java Fri Apr 25 09:57:13 2008
@@ -22,6 +22,7 @@
import org.apache.pig.Algebraic;
import org.apache.pig.EvalFunc;
+import org.apache.pig.backend.executionengine.ExecException;
import org.apache.pig.data.DataBag;
import org.apache.pig.data.DataType;
import org.apache.pig.data.Tuple;
@@ -37,7 +38,13 @@
@Override
public Double exec(Tuple input) throws IOException {
- return min(input);
+ try {
+ return min(input);
+ } catch (ExecException ee) {
+ IOException oughtToBeEE = new IOException();
+ ee.initCause(ee);
+ throw oughtToBeEE;
+ }
}
public String getInitial() {
@@ -57,17 +64,29 @@
@Override
public Tuple exec(Tuple input) throws IOException {
- return tfact.newTuple(min(input));
+ try {
+ return tfact.newTuple(min(input));
+ } catch (ExecException ee) {
+ IOException oughtToBeEE = new IOException();
+ ee.initCause(ee);
+ throw oughtToBeEE;
+ }
}
}
static public class Final extends EvalFunc<Double> {
@Override
public Double exec(Tuple input) throws IOException {
- return min(input);
+ try {
+ return min(input);
+ } catch (ExecException ee) {
+ IOException oughtToBeEE = new IOException();
+ ee.initCause(ee);
+ throw oughtToBeEE;
+ }
}
}
- static protected Double min(Tuple input) throws IOException {
+ static protected Double min(Tuple input) throws ExecException {
DataBag values = (DataBag)input.get(0);
double curMin = Double.POSITIVE_INFINITY;
@@ -78,7 +97,7 @@
if (d == null) continue;
curMin = java.lang.Math.min(curMin, d);
} catch (RuntimeException exp) {
- IOException newE = new IOException("Error processing: " +
+ ExecException newE = new ExecException("Error processing: " +
t.toString() + exp.getMessage());
newE.initCause(exp);
throw newE;
Modified: incubator/pig/branches/types/src/org/apache/pig/builtin/PigStorage.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/builtin/PigStorage.java?rev=651650&r1=651649&r2=651650&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/builtin/PigStorage.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/builtin/PigStorage.java Fri Apr 25 09:57:13 2008
@@ -26,6 +26,7 @@
import org.apache.pig.LoadFunc;
import org.apache.pig.StoreFunc;
+import org.apache.pig.backend.executionengine.ExecException;
import org.apache.pig.data.DataBag;
import org.apache.pig.data.DataByteArray;
import org.apache.pig.data.DataType;
@@ -116,7 +117,12 @@
// bytes, I don't get a string representation.
int sz = f.size();
for (int i = 0; i < sz; i++) {
- Object field = f.get(i);
+ Object field;
+ try {
+ field = f.get(i);
+ } catch (ExecException ee) {
+ throw new RuntimeException(ee);
+ }
switch (DataType.findType(field)) {
case DataType.NULL:
break; // just leave it empty
Modified: incubator/pig/branches/types/src/org/apache/pig/builtin/SUM.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/builtin/SUM.java?rev=651650&r1=651649&r2=651650&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/builtin/SUM.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/builtin/SUM.java Fri Apr 25 09:57:13 2008
@@ -22,6 +22,7 @@
import org.apache.pig.Algebraic;
import org.apache.pig.EvalFunc;
+import org.apache.pig.backend.executionengine.ExecException;
import org.apache.pig.data.DataBag;
import org.apache.pig.data.DataType;
import org.apache.pig.data.Tuple;
@@ -36,7 +37,13 @@
@Override
public Double exec(Tuple input) throws IOException {
- return sum(input);
+ try {
+ return sum(input);
+ } catch (ExecException ee) {
+ IOException oughtToBeEE = new IOException();
+ ee.initCause(ee);
+ throw oughtToBeEE;
+ }
}
public String getInitial() {
@@ -56,17 +63,29 @@
@Override
public Tuple exec(Tuple input) throws IOException {
- return tfact.newTuple(sum(input));
+ try {
+ return tfact.newTuple(sum(input));
+ } catch (ExecException ee) {
+ IOException oughtToBeEE = new IOException();
+ ee.initCause(ee);
+ throw oughtToBeEE;
+ }
}
}
static public class Final extends EvalFunc<Double> {
@Override
public Double exec(Tuple input) throws IOException {
- return sum(input);
+ try {
+ return sum(input);
+ } catch (ExecException ee) {
+ IOException oughtToBeEE = new IOException();
+ ee.initCause(ee);
+ throw oughtToBeEE;
+ }
}
}
- static protected double sum(Tuple input) throws IOException {
+ static protected double sum(Tuple input) throws ExecException {
DataBag values = (DataBag)input.get(0);
double sum = 0;
Modified: incubator/pig/branches/types/src/org/apache/pig/builtin/TOKENIZE.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/builtin/TOKENIZE.java?rev=651650&r1=651649&r2=651650&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/builtin/TOKENIZE.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/builtin/TOKENIZE.java Fri Apr 25 09:57:13 2008
@@ -21,6 +21,7 @@
import java.util.StringTokenizer;
import org.apache.pig.EvalFunc;
+import org.apache.pig.backend.executionengine.ExecException;
import org.apache.pig.data.BagFactory;
import org.apache.pig.data.DataBag;
import org.apache.pig.data.Tuple;
@@ -34,13 +35,19 @@
@Override
public DataBag exec(Tuple input) throws IOException {
- DataBag output = mBagFactory.newDefaultBag();
- String str = (String)input.get(0);
- StringTokenizer tok = new StringTokenizer(str, " \",()*", false);
- while (tok.hasMoreTokens()) {
- output.add(mTupleFactory.newTuple(tok.nextToken()));
+ try {
+ DataBag output = mBagFactory.newDefaultBag();
+ String str = (String)input.get(0);
+ StringTokenizer tok = new StringTokenizer(str, " \",()*", false);
+ while (tok.hasMoreTokens()) {
+ output.add(mTupleFactory.newTuple(tok.nextToken()));
+ }
+ return output;
+ } catch (ExecException ee) {
+ IOException oughtToBeEE = new IOException();
+ ee.initCause(ee);
+ throw oughtToBeEE;
}
- return output;
}
@Override
Modified: incubator/pig/branches/types/src/org/apache/pig/data/DataReaderWriter.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/data/DataReaderWriter.java?rev=651650&r1=651649&r2=651650&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/data/DataReaderWriter.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/data/DataReaderWriter.java Fri Apr 25 09:57:13 2008
@@ -24,6 +24,8 @@
import java.util.Iterator;
import java.util.Map;
+import org.apache.pig.backend.executionengine.ExecException;
+
/**
* A class to handle reading and writing of intermediate results of data
* types. This class could also be used for storing permanent results.
@@ -32,7 +34,7 @@
private static TupleFactory mTupleFactory = TupleFactory.getInstance();
private static BagFactory mBagFactory = BagFactory.getInstance();
- public static Object readDatum(DataInput in) throws IOException {
+ public static Object readDatum(DataInput in) throws IOException, ExecException {
// Read the data type
byte b = in.readByte();
switch (b) {
Modified: incubator/pig/branches/types/src/org/apache/pig/data/DataType.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/data/DataType.java?rev=651650&r1=651649&r2=651650&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/data/DataType.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/data/DataType.java Fri Apr 25 09:57:13 2008
@@ -17,7 +17,6 @@
*/
package org.apache.pig.data;
-import java.io.IOException;
import java.lang.Class;
import java.lang.reflect.Type;
import java.util.HashMap;
@@ -25,6 +24,8 @@
import java.util.Map;
import java.util.TreeMap;
+import org.apache.pig.backend.executionengine.ExecException;
+
/**
* A class of static final values used to encode data type. This could be
* done as an enumeration, but it done as byte codes instead to save
@@ -310,9 +311,9 @@
* already <b>know</b> that the object you have is an Integer you
* should just cast it.
* @return The object as a Integer.
- * @throws IOException if the type can't be forced to an Integer.
+ * @throws ExecException if the type can't be forced to an Integer.
*/
- public static Integer toInteger(Object o) throws IOException {
+ public static Integer toInteger(Object o) throws ExecException {
switch (findType(o)) {
case BOOLEAN:
if (((Boolean)o) == true) return new Integer(1);
@@ -344,7 +345,7 @@
case BAG:
case UNKNOWN:
default:
- throw new IOException("Cannot convert a " + findTypeName(o) +
+ throw new ExecException("Cannot convert a " + findTypeName(o) +
" to an Integer");
}
}
@@ -357,9 +358,9 @@
* already <b>know</b> that the object you have is a Long you
* should just cast it.
* @return The object as a Long.
- * @throws IOException if the type can't be forced to a Long.
+ * @throws ExecException if the type can't be forced to a Long.
*/
- public static Long toLong(Object o) throws IOException {
+ public static Long toLong(Object o) throws ExecException {
switch (findType(o)) {
case BOOLEAN:
if (((Boolean)o) == true) return new Long(1);
@@ -391,7 +392,7 @@
case BAG:
case UNKNOWN:
default:
- throw new IOException("Cannot convert a " + findTypeName(o) +
+ throw new ExecException("Cannot convert a " + findTypeName(o) +
" to a Long");
}
}
@@ -404,9 +405,9 @@
* already <b>know</b> that the object you have is a Float you
* should just cast it.
* @return The object as a Float.
- * @throws IOException if the type can't be forced to a Float.
+ * @throws ExecException if the type can't be forced to a Float.
*/
- public static Float toFloat(Object o) throws IOException {
+ public static Float toFloat(Object o) throws ExecException {
switch (findType(o)) {
case INTEGER:
return new Float(((Integer)o).floatValue());
@@ -435,7 +436,7 @@
case BAG:
case UNKNOWN:
default:
- throw new IOException("Cannot convert a " + findTypeName(o) +
+ throw new ExecException("Cannot convert a " + findTypeName(o) +
" to a Float");
}
}
@@ -448,9 +449,9 @@
* already <b>know</b> that the object you have is a Double you
* should just cast it.
* @return The object as a Double.
- * @throws IOException if the type can't be forced to a Double.
+ * @throws ExecException if the type can't be forced to a Double.
*/
- public static Double toDouble(Object o) throws IOException {
+ public static Double toDouble(Object o) throws ExecException {
switch (findType(o)) {
case INTEGER:
return new Double(((Integer)o).doubleValue());
@@ -479,7 +480,7 @@
case BAG:
case UNKNOWN:
default:
- throw new IOException("Cannot convert a " + findTypeName(o) +
+ throw new ExecException("Cannot convert a " + findTypeName(o) +
" to a Double");
}
}
@@ -490,15 +491,15 @@
* already <b>know</b> that the object you have is a Map you
* should just cast it.
* @return The object as a Double.
- * @throws IOException if the type can't be forced to a Double.
+ * @throws ExecException if the type can't be forced to a Double.
*/
- public static Map<Object, Object> toMap(Object o) throws IOException {
+ public static Map<Object, Object> toMap(Object o) throws ExecException {
if (o == null) return null;
if (o instanceof Map) {
return (Map<Object, Object>)o;
} else {
- throw new IOException("Cannot convert a " + findTypeName(o) +
+ throw new ExecException("Cannot convert a " + findTypeName(o) +
" to a Map");
}
}
@@ -509,15 +510,15 @@
* already <b>know</b> that the object you have is a Tuple you
* should just cast it.
* @return The object as a Double.
- * @throws IOException if the type can't be forced to a Double.
+ * @throws ExecException if the type can't be forced to a Double.
*/
- public static Tuple toTuple(Object o) throws IOException {
+ public static Tuple toTuple(Object o) throws ExecException {
if (o == null) return null;
if (o instanceof Tuple) {
return (Tuple)o;
} else {
- throw new IOException("Cannot convert a " + findTypeName(o) +
+ throw new ExecException("Cannot convert a " + findTypeName(o) +
" to a Tuple");
}
}
@@ -528,15 +529,15 @@
* already <b>know</b> that the object you have is a bag you
* should just cast it.
* @return The object as a Double.
- * @throws IOException if the type can't be forced to a Double.
+ * @throws ExecException if the type can't be forced to a Double.
*/
- public static DataBag toBag(Object o) throws IOException {
+ public static DataBag toBag(Object o) throws ExecException {
if (o == null) return null;
if (o instanceof DataBag) {
return (DataBag)o;
} else {
- throw new IOException("Cannot convert a " + findTypeName(o) +
+ throw new ExecException("Cannot convert a " + findTypeName(o) +
" to a DataBag");
}
}
Modified: incubator/pig/branches/types/src/org/apache/pig/data/DefaultAbstractBag.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/data/DefaultAbstractBag.java?rev=651650&r1=651649&r2=651650&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/data/DefaultAbstractBag.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/data/DefaultAbstractBag.java Fri Apr 25 09:57:13 2008
@@ -28,6 +28,7 @@
import java.util.Iterator;
import java.util.ArrayList;
+import org.apache.pig.backend.executionengine.ExecException;
import org.apache.pig.impl.util.Spillable;
//import org.apache.pig.backend.hadoop.executionengine.mapreduceExec.PigMapReduce;
@@ -268,8 +269,12 @@
long size = in.readLong();
for (long i = 0; i < size; i++) {
- Object o = DataReaderWriter.readDatum(in);
- add((Tuple)o);
+ try {
+ Object o = DataReaderWriter.readDatum(in);
+ add((Tuple)o);
+ } catch (ExecException ee) {
+ throw new RuntimeException(ee);
+ }
}
}
Modified: incubator/pig/branches/types/src/org/apache/pig/data/DefaultTuple.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/data/DefaultTuple.java?rev=651650&r1=651649&r2=651650&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/data/DefaultTuple.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/data/DefaultTuple.java Fri Apr 25 09:57:13 2008
@@ -29,6 +29,8 @@
import org.apache.hadoop.io.WritableComparable;
+import org.apache.pig.backend.executionengine.ExecException;
+
/**
* A default implementation of Tuple. This class will be created by the
* DefaultTupleFactory.
@@ -90,10 +92,10 @@
* Find out if a given field is null.
* @param fieldNum Number of field to check for null.
* @return true if the field is null, false otherwise.
- * @throws IOException if the field number given is greater
+ * @throws ExecException if the field number given is greater
* than or equal to the number of fields in the tuple.
*/
- public boolean isNull(int fieldNum) throws IOException {
+ public boolean isNull(int fieldNum) throws ExecException {
checkBounds(fieldNum);
return (mFields.get(fieldNum) == null);
}
@@ -104,10 +106,10 @@
* @return type, encoded as a byte value. The values are taken from
* the class DataType. If the field is null, then DataType.UNKNOWN
* will be returned.
- * @throws IOException if the field number is greater than or equal to
+ * @throws ExecException if the field number is greater than or equal to
* the number of fields in the tuple.
*/
- public byte getType(int fieldNum) throws IOException {
+ public byte getType(int fieldNum) throws ExecException {
checkBounds(fieldNum);
return DataType.findType(mFields.get(fieldNum));
}
@@ -116,10 +118,10 @@
* Get the value in a given field.
* @param fieldNum Number of the field to get the value for.
* @return value, as an Object.
- * @throws IOException if the field number is greater than or equal to
+ * @throws ExecException if the field number is greater than or equal to
* the number of fields in the tuple.
*/
- public Object get(int fieldNum) throws IOException {
+ public Object get(int fieldNum) throws ExecException {
checkBounds(fieldNum);
return mFields.get(fieldNum);
}
@@ -137,10 +139,10 @@
* Set the value in a given field.
* @param fieldNum Number of the field to set the value for.
* @param val Object to put in the indicated field.
- * @throws IOException if the field number is greater than or equal to
+ * @throws ExecException if the field number is greater than or equal to
* the number of fields in the tuple.
*/
- public void set(int fieldNum, Object val) throws IOException {
+ public void set(int fieldNum, Object val) throws ExecException {
checkBounds(fieldNum);
mFields.set(fieldNum, val);
}
@@ -177,14 +179,14 @@
* tuple must be atomic (no bags, tuples, or maps).
* @param delim Delimiter to use in the string.
* @return A string containing the tuple.
- * @throws IOException if a non-atomic value is found.
+ * @throws ExecException if a non-atomic value is found.
*/
- public String toDelimitedString(String delim) throws IOException {
+ public String toDelimitedString(String delim) throws ExecException {
StringBuilder buf = new StringBuilder();
for (Iterator<Object> it = mFields.iterator(); it.hasNext();) {
Object field = it.next();
if (DataType.isComplex(field)) {
- throw new IOException("Unable to convert non-flat tuple to string.");
+ throw new ExecException("Unable to convert non-flat tuple to string.");
}
buf.append(field.toString());
if (it.hasNext())
@@ -228,7 +230,7 @@
if (c != 0) {
return c;
}
- } catch (IOException e) {
+ } catch (ExecException e) {
throw new RuntimeException("Unable to compare tuples", e);
}
}
@@ -261,7 +263,11 @@
int sz = size();
out.writeInt(sz);
for (int i = 0; i < sz; i++) {
- Object d = get(i);
+ try {
+ Object d = get(i);
+ } catch (ExecException ee) {
+ throw new RuntimeException(ee);
+ }
DataReaderWriter.writeDatum(out, mFields.get(i));
}
}
@@ -280,7 +286,11 @@
// Read the number of fields
int sz = in.readInt();
for (int i = 0; i < sz; i++) {
- append(DataReaderWriter.readDatum(in));
+ try {
+ append(DataReaderWriter.readDatum(in));
+ } catch (ExecException ee) {
+ throw new RuntimeException(ee);
+ }
}
}
@@ -342,9 +352,9 @@
}
}
- private void checkBounds(int fieldNum) throws IOException {
+ private void checkBounds(int fieldNum) throws ExecException {
if (fieldNum >= mFields.size()) {
- throw new IOException("Request for field number " + fieldNum +
+ throw new ExecException("Request for field number " + fieldNum +
" exceeds tuple size of " + mFields.size());
}
}
Modified: incubator/pig/branches/types/src/org/apache/pig/data/DefaultTupleFactory.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/data/DefaultTupleFactory.java?rev=651650&r1=651649&r2=651650&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/data/DefaultTupleFactory.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/data/DefaultTupleFactory.java Fri Apr 25 09:57:13 2008
@@ -17,10 +17,11 @@
*/
package org.apache.pig.data;
-import java.io.IOException;
import java.lang.Class;
import java.util.List;
+import org.apache.pig.backend.executionengine.ExecException;
+
/**
* A bag factory. Can be used to generate different types of bags
* depending on what is needed.
@@ -43,7 +44,7 @@
Tuple t = new DefaultTuple(1);
try {
t.set(0, datum);
- } catch (IOException e) {
+ } catch (ExecException e) {
// The world has come to an end, we just allocated a tuple with one slot
// but we can't write to that slot.
throw new RuntimeException("Unable to write to field 0 in newly " +
Modified: incubator/pig/branches/types/src/org/apache/pig/data/Tuple.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/data/Tuple.java?rev=651650&r1=651649&r2=651650&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/data/Tuple.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/data/Tuple.java Fri Apr 25 09:57:13 2008
@@ -17,11 +17,12 @@
*/
package org.apache.pig.data;
-import java.io.IOException;
import java.util.List;
import org.apache.hadoop.io.WritableComparable;
+import org.apache.pig.backend.executionengine.ExecException;
+
/**
* An ordered list of Data. A tuple has fields, numbered 0 through
* (number of fields - 1). The entry in the field can be any datatype,
@@ -53,10 +54,10 @@
* Find out if a given field is null.
* @param fieldNum Number of field to check for null.
* @return true if the field is null, false otherwise.
- * @throws IOException if the field number given is greater
+ * @throws ExecException if the field number given is greater
* than or equal to the number of fields in the tuple.
*/
- boolean isNull(int fieldNum) throws IOException;
+ boolean isNull(int fieldNum) throws ExecException;
/**
* Find the type of a given field.
@@ -64,19 +65,19 @@
* @return type, encoded as a byte value. The values are taken from
* the class DataType. If the field is null, then DataType.UNKNOWN
* will be returned.
- * @throws IOException if the field number is greater than or equal to
+ * @throws ExecException if the field number is greater than or equal to
* the number of fields in the tuple.
*/
- byte getType(int fieldNum) throws IOException;
+ byte getType(int fieldNum) throws ExecException;
/**
* Get the value in a given field.
* @param fieldNum Number of the field to get the value for.
* @return value, as an Object.
- * @throws IOException if the field number is greater than or equal to
+ * @throws ExecException if the field number is greater than or equal to
* the number of fields in the tuple.
*/
- Object get(int fieldNum) throws IOException;
+ Object get(int fieldNum) throws ExecException;
/**
* Get all of the fields in the tuple as a list.
@@ -89,10 +90,10 @@
* Set the value in a given field.
* @param fieldNum Number of the field to set the value for.
* @param val Object to put in the indicated field.
- * @throws IOException if the field number is greater than or equal to
+ * @throws ExecException if the field number is greater than or equal to
* the number of fields in the tuple.
*/
- void set(int fieldNum, Object val) throws IOException;
+ void set(int fieldNum, Object val) throws ExecException;
/**
* Append a field to a tuple. This method is not efficient as it may
@@ -117,7 +118,7 @@
* tuple must be atomic (no bags, tuples, or maps).
* @param delim Delimiter to use in the string.
* @return A string containing the tuple.
- * @throws IOException if a non-atomic value is found.
+ * @throws ExecException if a non-atomic value is found.
*/
- String toDelimitedString(String delim) throws IOException;
+ String toDelimitedString(String delim) throws ExecException;
}
Modified: incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOBinCond.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOBinCond.java?rev=651650&r1=651649&r2=651650&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOBinCond.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOBinCond.java Fri Apr 25 09:57:13 2008
@@ -18,11 +18,11 @@
package org.apache.pig.impl.logicalLayer;
-import java.io.IOException;
+import org.apache.pig.impl.logicalLayer.FrontendException;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
import org.apache.pig.impl.plan.VisitorException;
import org.apache.pig.impl.plan.PlanVisitor;
-import org.apache.pig.impl.logicalLayer.schema.Schema;
public class LOBinCond extends ExpressionOperator {
@@ -80,12 +80,12 @@
}
@Override
- public Schema getSchema() throws IOException {
+ public Schema getSchema() throws FrontendException {
if (!mIsSchemaComputed && (null == mSchema)) {
try {
mSchema = mLhsOp.getSchema();
mIsSchemaComputed = true;
- } catch (IOException ioe) {
+ } catch (FrontendException ioe) {
mSchema = null;
mIsSchemaComputed = false;
throw ioe;
Modified: incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOCogroup.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOCogroup.java?rev=651650&r1=651649&r2=651650&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOCogroup.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOCogroup.java Fri Apr 25 09:57:13 2008
@@ -17,13 +17,13 @@
*/
package org.apache.pig.impl.logicalLayer;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.pig.data.DataType;
import org.apache.pig.impl.plan.VisitorException;
+import org.apache.pig.impl.logicalLayer.FrontendException;
import org.apache.pig.impl.logicalLayer.schema.Schema;
import org.apache.pig.impl.plan.PlanVisitor;
@@ -75,7 +75,7 @@
}
@Override
- public Schema getSchema() throws IOException {
+ public Schema getSchema() throws FrontendException {
// TODO create schema
/**
* Dumping my understanding of how the schema of a Group/CoGroup will
Modified: incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LODistinct.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LODistinct.java?rev=651650&r1=651649&r2=651650&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LODistinct.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LODistinct.java Fri Apr 25 09:57:13 2008
@@ -21,6 +21,7 @@
import java.util.List;
import java.io.IOException;
+import org.apache.pig.impl.logicalLayer.FrontendException;
import org.apache.pig.impl.logicalLayer.schema.Schema;
import org.apache.pig.impl.plan.PlanVisitor;
import org.apache.pig.impl.plan.VisitorException;
@@ -45,18 +46,18 @@
}
@Override
- public Schema getSchema() throws IOException {
+ public Schema getSchema() throws FrontendException {
if (!mIsSchemaComputed && (null == mSchema)) {
// Get the schema of the parent
Collection<LogicalOperator> s = mPlan.getSuccessors(this);
try {
LogicalOperator op = s.iterator().next();
if(null == op) {
- throw new IOException("Could not find operator in plan");
+ throw new FrontendException("Could not find operator in plan");
}
mSchema = s.iterator().next().getSchema();
mIsSchemaComputed = true;
- } catch (IOException ioe) {
+ } catch (FrontendException ioe) {
mSchema = null;
mIsSchemaComputed = false;
throw ioe;
Modified: incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOFilter.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOFilter.java?rev=651650&r1=651649&r2=651650&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOFilter.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOFilter.java Fri Apr 25 09:57:13 2008
@@ -17,8 +17,8 @@
*/
package org.apache.pig.impl.logicalLayer;
-import java.io.IOException;
import java.util.List;
+import org.apache.pig.impl.logicalLayer.FrontendException;
import org.apache.pig.impl.logicalLayer.schema.Schema;
import org.apache.pig.impl.plan.PlanVisitor;
import org.apache.pig.impl.plan.VisitorException;
@@ -60,12 +60,12 @@
}
@Override
- public Schema getSchema() throws IOException {
+ public Schema getSchema() throws FrontendException {
if (!mIsSchemaComputed && (null == mSchema)) {
try {
mSchema = mInput.getSchema();
mIsSchemaComputed = true;
- } catch (IOException ioe) {
+ } catch (FrontendException ioe) {
mSchema = null;
mIsSchemaComputed = false;
throw ioe;
Modified: incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOForEach.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOForEach.java?rev=651650&r1=651649&r2=651650&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOForEach.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOForEach.java Fri Apr 25 09:57:13 2008
@@ -17,9 +17,9 @@
*/
package org.apache.pig.impl.logicalLayer;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+import org.apache.pig.impl.logicalLayer.FrontendException;
import org.apache.pig.impl.logicalLayer.schema.Schema;
import org.apache.pig.impl.plan.PlanVisitor;
import org.apache.pig.impl.plan.VisitorException;
@@ -59,7 +59,7 @@
}
@Override
- public Schema getSchema() throws IOException {
+ public Schema getSchema() throws FrontendException {
if (mSchema == null) {
// Assuming that the last operator is the GENERATE
// foreach has to terminate with a GENERATE
@@ -67,7 +67,7 @@
try {
mSchema = last.getSchema();
mIsSchemaComputed = true;
- } catch (IOException ioe) {
+ } catch (FrontendException ioe) {
mSchema = null;
mIsSchemaComputed = false;
throw ioe;
Modified: incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOGenerate.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOGenerate.java?rev=651650&r1=651649&r2=651650&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOGenerate.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOGenerate.java Fri Apr 25 09:57:13 2008
@@ -17,14 +17,14 @@
*/
package org.apache.pig.impl.logicalLayer;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.apache.pig.data.DataType;
-import org.apache.pig.impl.plan.VisitorException;
+import org.apache.pig.impl.logicalLayer.FrontendException;
import org.apache.pig.impl.logicalLayer.schema.Schema;
import org.apache.pig.impl.plan.PlanVisitor;
+import org.apache.pig.impl.plan.VisitorException;
public class LOGenerate extends LogicalOperator {
private static final long serialVersionUID = 2L;
@@ -72,7 +72,7 @@
}
@Override
- public Schema getSchema() throws IOException {
+ public Schema getSchema() throws FrontendException {
if (mSchema == null) {
List<Schema.FieldSchema> fss = new ArrayList<Schema.FieldSchema>(
mProjections.size());
@@ -81,7 +81,7 @@
if (op.getType() == DataType.TUPLE) {
try {
fss.add(new Schema.FieldSchema(opAlias, op.getSchema()));
- } catch (IOException ioe) {
+ } catch (FrontendException ioe) {
mSchema = null;
mIsSchemaComputed = false;
throw ioe;
Modified: incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOLoad.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOLoad.java?rev=651650&r1=651649&r2=651650&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOLoad.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LOLoad.java Fri Apr 25 09:57:13 2008
@@ -86,16 +86,16 @@
}
@Override
- public Schema getSchema() throws IOException {
+ public Schema getSchema() throws FrontendException {
if (!mIsSchemaComputed && (null == mSchema)) {
// get the schema of the load function
try {
mSchema = mLoadFunc.determineSchema(mSchemaFile);
mIsSchemaComputed = true;
- } catch (Exception e) {
- IOException ioe = new IOException(e.getMessage());
- ioe.setStackTrace(e.getStackTrace());
- throw ioe;
+ } catch (IOException ioe) {
+ FrontendException fee = new FrontendException(ioe.getMessage());
+ fee.initCause(ioe);
+ throw fee;
}
}
return mSchema;
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=651650&r1=651649&r2=651650&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 Fri Apr 25 09:57:13 2008
@@ -17,14 +17,14 @@
*/
package org.apache.pig.impl.logicalLayer;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
-import org.apache.pig.impl.plan.VisitorException;
+import org.apache.pig.impl.logicalLayer.FrontendException;
import org.apache.pig.impl.logicalLayer.schema.Schema;
+import org.apache.pig.impl.plan.VisitorException;
import org.apache.pig.impl.plan.PlanVisitor;
public class LOSort extends LogicalOperator {
@@ -80,18 +80,18 @@
}
@Override
- public Schema getSchema() throws IOException {
+ public Schema getSchema() throws FrontendException {
if (!mIsSchemaComputed && (null == mSchema)) {
// get our parent's schema
Collection<LogicalOperator> s = mPlan.getSuccessors(this);
try {
LogicalOperator op = s.iterator().next();
if(null == op) {
- throw new IOException("Could not find operator in plan");
+ throw new FrontendException("Could not find operator in plan");
}
mSchema = op.getSchema();
mIsSchemaComputed = true;
- } catch (IOException ioe) {
+ } catch (FrontendException ioe) {
mSchema = null;
mIsSchemaComputed = false;
throw ioe;
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=651650&r1=651649&r2=651650&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 Fri Apr 25 09:57:13 2008
@@ -21,11 +21,11 @@
import java.util.Collection;
import java.util.List;
import java.util.Map;
-import java.io.IOException;
import java.util.Set;
-import org.apache.pig.impl.plan.VisitorException;
+import org.apache.pig.impl.logicalLayer.FrontendException;
import org.apache.pig.impl.logicalLayer.schema.Schema;
+import org.apache.pig.impl.plan.VisitorException;
import org.apache.pig.impl.plan.PlanVisitor;
public class LOSplit extends LogicalOperator {
@@ -69,18 +69,18 @@
}
@Override
- public Schema getSchema() throws IOException {
+ public Schema getSchema() throws FrontendException {
if (!mIsSchemaComputed && (null == mSchema)) {
// get our parent's schema
Collection<LogicalOperator> s = mPlan.getSuccessors(this);
try {
LogicalOperator op = s.iterator().next();
if (null == op) {
- throw new IOException("Could not find operator in plan");
+ throw new FrontendException("Could not find operator in plan");
}
mSchema = s.iterator().next().getSchema();
mIsSchemaComputed = true;
- } catch (IOException ioe) {
+ } catch (FrontendException ioe) {
mSchema = null;
mIsSchemaComputed = false;
throw ioe;
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=651650&r1=651649&r2=651650&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 Fri Apr 25 09:57:13 2008
@@ -23,6 +23,7 @@
import java.io.IOException;
import org.apache.pig.data.DataType;
+import org.apache.pig.impl.logicalLayer.FrontendException;
import org.apache.pig.impl.logicalLayer.parser.ParseException;
import org.apache.pig.impl.logicalLayer.schema.Schema;
import org.apache.pig.impl.plan.Operator;
@@ -105,7 +106,7 @@
// asked, so ask them to do it.
try {
getSchema();
- } catch (IOException ioe) {
+ } catch (FrontendException ioe) {
// It's fine, it just means we don't have a schema yet.
}
if (mSchema == null) mSchema = schema;
@@ -115,7 +116,7 @@
/**
* Get a copy of the schema for the output of this operator.
*/
- public abstract Schema getSchema() throws IOException;
+ public abstract Schema getSchema() throws FrontendException;
/**
* Set the type of this operator. This should only be called by the type
Modified: incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/plans/PhysicalPlan.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/plans/PhysicalPlan.java?rev=651650&r1=651649&r2=651650&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/plans/PhysicalPlan.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/plans/PhysicalPlan.java Fri Apr 25 09:57:13 2008
@@ -17,13 +17,13 @@
*/
package org.apache.pig.impl.physicalLayer.plans;
-import java.io.IOException;
import java.io.OutputStream;
import java.util.List;
import org.apache.pig.data.Tuple;
import org.apache.pig.impl.physicalLayer.topLevelOperators.PhysicalOperator;
import org.apache.pig.impl.plan.OperatorPlan;
+import org.apache.pig.impl.plan.PlanException;
/**
*
@@ -56,7 +56,7 @@
@Override
public void connect(E from, E to)
- throws IOException {
+ throws PlanException {
super.connect(from, to);
to.setInputs(getPredecessors(to));
}
Modified: incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/POGenerate.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/POGenerate.java?rev=651650&r1=651649&r2=651650&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/POGenerate.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/POGenerate.java Fri Apr 25 09:57:13 2008
@@ -258,15 +258,7 @@
if(in instanceof Tuple) {
Tuple t = (Tuple)in;
for(int j = 0; j < t.size(); ++j) {
- try {
- out.append(t.get(j));
- } catch (IOException e) {
- ExecException ee =
- new ExecException("Unable to reference field "
- + j + " in tuple " + t);
- ee.initCause(e);
- throw ee;
- }
+ out.append(t.get(j));
}
} else
out.append(in);
Modified: incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/POPackage.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/POPackage.java?rev=651650&r1=651649&r2=651650&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/POPackage.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/POPackage.java Fri Apr 25 09:57:13 2008
@@ -17,7 +17,6 @@
*/
package org.apache.pig.impl.physicalLayer.topLevelOperators;
-import java.io.IOException;
import java.util.Iterator;
import java.util.List;
@@ -184,7 +183,7 @@
}
res.set(i+1,bag);
}
- }catch(IOException e){
+ }catch(ExecException e){
log.error("Received error while constructing the output tuple");
return new Result();
}
Modified: incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/expressionOperators/POProject.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/expressionOperators/POProject.java?rev=651650&r1=651649&r2=651650&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/expressionOperators/POProject.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/impl/physicalLayer/topLevelOperators/expressionOperators/POProject.java Fri Apr 25 09:57:13 2008
@@ -118,7 +118,7 @@
}
try {
res.result = ((Tuple)res.result).get(column);
- } catch (IOException e) {
+ } catch (ExecException e) {
res.returnStatus = POStatus.STATUS_ERR;
log.warn(e.getMessage());
}
@@ -202,7 +202,7 @@
res.result = (Tuple)ret;
}
return res;
- } catch (IOException e) {
+ } catch (ExecException e) {
res.returnStatus = POStatus.STATUS_ERR;
log.error(e.getMessage());
}
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=651650&r1=651649&r2=651650&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 Fri Apr 25 09:57:13 2008
@@ -17,7 +17,6 @@
*/
package org.apache.pig.impl.plan;
-import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
@@ -117,11 +116,11 @@
* flow.
* @param from Operator data will flow from.
* @param to Operator data will flow to.
- * @throws IOException if this edge will create multiple inputs for an
+ * @throws PlanException if this edge will create multiple inputs for an
* operator that does not support multiple inputs or create multiple outputs
* for an operator that does not support multiple outputs.
*/
- public void connect(E from, E to) throws IOException {
+ public void connect(E from, E to) throws PlanException {
markDirty();
// Check that both nodes are in the plan.
@@ -132,7 +131,7 @@
// whether it supports multiple outputs.
if (mFromEdges.get(from) != null &&
!from.supportsMultipleOutputs()) {
- throw new IOException("Attempt to give operator of type " +
+ throw new PlanException("Attempt to give operator of type " +
from.getClass().getName() + " multiple outputs. This operator does "
+ "not support multiple outputs.");
}
@@ -141,7 +140,7 @@
// whether it supports multiple inputs.
if (mToEdges.get(to) != null &&
!to.supportsMultipleInputs()) {
- throw new IOException("Attempt to give operator of type " +
+ throw new PlanException("Attempt to give operator of type " +
from.getClass().getName() + " multiple inputs. This operator does "
+ "not support multiple inputs.");
}
@@ -231,9 +230,9 @@
}
}
- private void checkInPlan(E op) throws IOException {
+ private void checkInPlan(E op) throws PlanException {
if (mOps.get(op) == null) {
- throw new IOException("Attempt to connect operator " +
+ throw new PlanException("Attempt to connect operator " +
op.name() + " which is not in the plan.");
}
}
Added: incubator/pig/branches/types/src/org/apache/pig/impl/plan/PlanException.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/plan/PlanException.java?rev=651650&view=auto
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/impl/plan/PlanException.java (added)
+++ incubator/pig/branches/types/src/org/apache/pig/impl/plan/PlanException.java Fri Apr 25 09:57:13 2008
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pig.impl.plan;
+
+import org.apache.pig.impl.logicalLayer.FrontendException;
+
+public class PlanException extends FrontendException {
+
+ public PlanException (String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public PlanException() {
+ this(null, null);
+ }
+
+ public PlanException(String message) {
+ this(message, null);
+ }
+
+ public PlanException(Throwable cause) {
+ this(null, cause);
+ }
+}
Modified: incubator/pig/branches/types/test/org/apache/pig/test/TestOperatorPlan.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/test/org/apache/pig/test/TestOperatorPlan.java?rev=651650&r1=651649&r2=651650&view=diff
==============================================================================
--- incubator/pig/branches/types/test/org/apache/pig/test/TestOperatorPlan.java (original)
+++ incubator/pig/branches/types/test/org/apache/pig/test/TestOperatorPlan.java Fri Apr 25 09:57:13 2008
@@ -17,7 +17,6 @@
*/
package org.apache.pig.test;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -286,7 +285,7 @@
boolean sawError = false;
try {
plan.connect(ops[2], bogus);
- } catch (IOException ioe) {
+ } catch (PlanException ioe) {
assertEquals("Attempt to connect operator X which is not in "
+ "the plan.", ioe.getMessage());
sawError = true;
@@ -310,7 +309,7 @@
sawError = false;
try {
plan.connect(bogus, ops[1]);
- } catch (IOException ioe) {
+ } catch (PlanException ioe) {
assertEquals("Attempt to give operator of type " +
"org.apache.pig.test.TestOperatorPlan$SingleOperator " +
"multiple inputs. This operator does "
@@ -325,7 +324,7 @@
sawError = false;
try {
plan.connect(ops[0], bogus);
- } catch (IOException ioe) {
+ } catch (PlanException ioe) {
assertEquals("Attempt to give operator of type " +
"org.apache.pig.test.TestOperatorPlan$SingleOperator " +
"multiple outputs. This operator does "
Modified: incubator/pig/branches/types/test/org/apache/pig/test/Util.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/test/org/apache/pig/test/Util.java?rev=651650&r1=651649&r2=651650&view=diff
==============================================================================
--- incubator/pig/branches/types/test/org/apache/pig/test/Util.java (original)
+++ incubator/pig/branches/types/test/org/apache/pig/test/Util.java Fri Apr 25 09:57:13 2008
@@ -17,35 +17,34 @@
*/
package org.apache.pig.test;
-import java.io.IOException;
-
+import org.apache.pig.backend.executionengine.ExecException;
import org.apache.pig.data.*;
public class Util {
// Helper Functions
// =================
- static public Tuple loadFlatTuple(Tuple t, int[] input) throws IOException {
+ static public Tuple loadFlatTuple(Tuple t, int[] input) throws ExecException {
for (int i = 0; i < input.length; i++) {
t.set(i, new Integer(input[i]));
}
return t;
}
- static public Tuple loadTuple(Tuple t, String[] input) throws IOException {
+ static public Tuple loadTuple(Tuple t, String[] input) throws ExecException {
for (int i = 0; i < input.length; i++) {
t.set(i, input[i]);
}
return t;
}
- static public Tuple loadTuple(Tuple t, DataByteArray[] input) throws IOException {
+ static public Tuple loadTuple(Tuple t, DataByteArray[] input) throws ExecException {
for (int i = 0; i < input.length; i++) {
t.set(i, input[i]);
}
return t;
}
- static public Tuple loadNestTuple(Tuple t, int[] input) throws IOException {
+ static public Tuple loadNestTuple(Tuple t, int[] input) throws ExecException {
DataBag bag = BagFactory.getInstance().newDefaultBag();
for(int i = 0; i < input.length; i++) {
Tuple f = TupleFactory.getInstance().newTuple(1);
@@ -56,7 +55,7 @@
return t;
}
- static public Tuple loadNestTuple(Tuple t, long[] input) throws IOException {
+ static public Tuple loadNestTuple(Tuple t, long[] input) throws ExecException {
DataBag bag = BagFactory.getInstance().newDefaultBag();
for(int i = 0; i < input.length; i++) {
Tuple f = TupleFactory.getInstance().newTuple(1);
@@ -68,7 +67,7 @@
}
- static public Tuple loadNestTuple(Tuple t, int[][] input) throws IOException {
+ static public Tuple loadNestTuple(Tuple t, int[][] input) throws ExecException {
for (int i = 0; i < input.length; i++) {
DataBag bag = BagFactory.getInstance().newDefaultBag();
Tuple f = loadFlatTuple(TupleFactory.getInstance().newTuple(input[i].length), input[i]);
@@ -78,7 +77,7 @@
return t;
}
- static public Tuple loadTuple(Tuple t, String[][] input) throws IOException {
+ static public Tuple loadTuple(Tuple t, String[][] input) throws ExecException {
for (int i = 0; i < input.length; i++) {
DataBag bag = BagFactory.getInstance().newDefaultBag();
Tuple f = loadTuple(TupleFactory.getInstance().newTuple(input[i].length), input[i]);
Modified: incubator/pig/branches/types/test/org/apache/pig/test/utils/GenPhyOp.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/test/org/apache/pig/test/utils/GenPhyOp.java?rev=651650&r1=651649&r2=651650&view=diff
==============================================================================
--- incubator/pig/branches/types/test/org/apache/pig/test/utils/GenPhyOp.java (original)
+++ incubator/pig/branches/types/test/org/apache/pig/test/utils/GenPhyOp.java Fri Apr 25 09:57:13 2008
@@ -17,11 +17,11 @@
*/
package org.apache.pig.test.utils;
-import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
+import org.apache.pig.backend.executionengine.ExecException;
import org.apache.pig.data.DataType;
import org.apache.pig.data.Tuple;
import org.apache.pig.impl.logicalLayer.OperatorKey;
@@ -50,6 +50,7 @@
import org.apache.pig.impl.physicalLayer.topLevelOperators.expressionOperators.binaryExprOps.comparators.LTOrEqualToExpr;
import org.apache.pig.impl.physicalLayer.topLevelOperators.expressionOperators.binaryExprOps.comparators.LessThanExpr;
import org.apache.pig.impl.physicalLayer.topLevelOperators.expressionOperators.binaryExprOps.comparators.NotEqualToExpr;
+import org.apache.pig.impl.plan.PlanException;
public class GenPhyOp {
static Random r = new Random();
@@ -125,9 +126,9 @@
* result types and #projects for *
* @return - The POGenerate operator which has the exprplan
* for generate grpCol, * set.
- * @throws IOException
+ * @throws ExecException
*/
- public static POGenerate topGenerateOpWithExPlan(int grpCol, Tuple sample) throws IOException {
+ public static POGenerate topGenerateOpWithExPlan(int grpCol, Tuple sample) throws ExecException {
POProject prj1 = new POProject(new OperatorKey("", r.nextLong()), -1, grpCol);
prj1.setResultType(sample.getType(grpCol));
prj1.setOverloaded(false);
@@ -174,9 +175,9 @@
* result type
* @return - The POGenerate operator which has the exprplan
* for 'generate field' set.
- * @throws IOException
+ * @throws ExecException
*/
- public static POGenerate topGenerateOpWithExPlanForFe(int field, Tuple sample) throws IOException {
+ public static POGenerate topGenerateOpWithExPlanForFe(int field, Tuple sample) throws ExecException {
POProject prj1 = new POProject(new OperatorKey("", r.nextLong()), -1, field);
prj1.setResultType(sample.getType(field));
prj1.setOverloaded(false);
@@ -205,9 +206,9 @@
* @param grpCol - The column to be grouped on
* @param sample - Sample tuple needed for topGenerateOpWithExPlan
* @return - The POLocalRearrange operator
- * @throws IOException
+ * @throws ExecException
*/
- public static POLocalRearrange topLocalRearrangeOPWithPlan(int index, int grpCol, Tuple sample) throws IOException{
+ public static POLocalRearrange topLocalRearrangeOPWithPlan(int index, int grpCol, Tuple sample) throws ExecException{
POGenerate gen = topGenerateOpWithExPlan(grpCol, sample);
PhysicalPlan<PhysicalOperator> pp = new PhysicalPlan<PhysicalOperator>();
pp.add(gen);
@@ -225,9 +226,9 @@
* @param field - The column to be generated
* @param sample - Sample tuple needed for topGenerateOpWithExPlanForFe
* @return - The POForEach operator
- * @throws IOException
+ * @throws ExecException
*/
- public static POForEach topForEachOPWithPlan(int field, Tuple sample) throws IOException{
+ public static POForEach topForEachOPWithPlan(int field, Tuple sample) throws ExecException{
POGenerate gen = topGenerateOpWithExPlanForFe(field, sample);
PhysicalPlan<PhysicalOperator> pp = new PhysicalPlan<PhysicalOperator>();
pp.add(gen);
@@ -249,7 +250,7 @@
}
public static POFilter topFilterOpWithExPlan(int lhsVal, int rhsVal)
- throws IOException {
+ throws PlanException {
POFilter ret = new POFilter(new OperatorKey("", r.nextLong()));
ConstantExpression ce1 = GenPhyOp.exprConst();
@@ -277,7 +278,7 @@
}
public static POFilter topFilterOpWithProj(int col, int rhsVal)
- throws IOException {
+ throws PlanException {
POFilter ret = new POFilter(new OperatorKey("", r.nextLong()));
POProject proj = exprProject();
Modified: incubator/pig/branches/types/test/org/apache/pig/test/utils/TestHelper.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/test/org/apache/pig/test/utils/TestHelper.java?rev=651650&r1=651649&r2=651650&view=diff
==============================================================================
--- incubator/pig/branches/types/test/org/apache/pig/test/utils/TestHelper.java (original)
+++ incubator/pig/branches/types/test/org/apache/pig/test/utils/TestHelper.java Fri Apr 25 09:57:13 2008
@@ -17,9 +17,9 @@
*/
package org.apache.pig.test.utils;
-import java.io.IOException;
import java.util.Iterator;
+import org.apache.pig.backend.executionengine.ExecException;
import org.apache.pig.data.DataBag;
import org.apache.pig.data.DefaultBagFactory;
import org.apache.pig.data.DefaultTuple;
@@ -61,7 +61,7 @@
return equal;
}
- public static DataBag projectBag(DataBag db2, int i) throws IOException {
+ public static DataBag projectBag(DataBag db2, int i) throws ExecException {
DataBag ret = DefaultBagFactory.getInstance().newDefaultBag();
for (Tuple tuple : db2) {
Object o = tuple.get(i);