You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by da...@apache.org on 2011/04/20 08:00:25 UTC
svn commit: r1095279 - in /pig/branches/branch-0.9: CHANGES.txt
src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POCast.java
Author: daijy
Date: Wed Apr 20 06:00:25 2011
New Revision: 1095279
URL: http://svn.apache.org/viewvc?rev=1095279&view=rev
Log:
PIG-1975: Need to provide backward compatibility for legacy LoadCaster (without bytesToMap(bytes, fieldSchema))
Modified:
pig/branches/branch-0.9/CHANGES.txt
pig/branches/branch-0.9/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POCast.java
Modified: pig/branches/branch-0.9/CHANGES.txt
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.9/CHANGES.txt?rev=1095279&r1=1095278&r2=1095279&view=diff
==============================================================================
--- pig/branches/branch-0.9/CHANGES.txt (original)
+++ pig/branches/branch-0.9/CHANGES.txt Wed Apr 20 06:00:25 2011
@@ -158,6 +158,8 @@ PIG-1696: Performance: Use System.arrayc
BUG FIXES
+PIG-1975: Need to provide backward compatibility for legacy LoadCaster (without bytesToMap(bytes, fieldSchema)) (daijy)
+
PIG-1987: -dryrun does not work with set (rding)
PIG-1871: Dont throw exception if partition filters cannot be pushed up. (rding)
Modified: pig/branches/branch-0.9/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POCast.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.9/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POCast.java?rev=1095279&r1=1095278&r2=1095279&view=diff
==============================================================================
--- pig/branches/branch-0.9/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POCast.java (original)
+++ pig/branches/branch-0.9/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POCast.java Wed Apr 20 06:00:25 2011
@@ -826,7 +826,7 @@ public class POCast extends ExpressionOp
return res;
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({ "unchecked", "deprecation" })
private Object convertWithSchema(Object obj, ResourceFieldSchema fs) throws IOException {
Object result = null;
@@ -903,7 +903,14 @@ public class POCast extends ExpressionOp
result = obj;
} else if (obj instanceof DataByteArray) {
if (null != caster) {
- result = caster.bytesToMap(((DataByteArray)obj).get(), fs);
+ try {
+ result = caster.bytesToMap(((DataByteArray)obj).get(), fs);
+ } catch(AbstractMethodError e) {
+ // this is for backward compatibility wherein some old LoadCaster
+ // which does not implement bytesToMap(byte[] b, ResourceFieldSchema fieldSchema)
+ // In this case, we only cast bytes to map, but leave the value as bytearray
+ result = caster.bytesToMap(((DataByteArray)obj).get());
+ }
} else {
int errCode = 1075;
String msg = "Received a bytearray from the UDF. Cannot determine how to convert the bytearray to tuple.";
@@ -1197,6 +1204,7 @@ public class POCast extends ExpressionOp
return res;
}
+ @SuppressWarnings("deprecation")
@Override
public Result getNext(Map m) throws ExecException {
PhysicalOperator in = inputs.get(0);
@@ -1253,7 +1261,14 @@ public class POCast extends ExpressionOp
}
try {
if (null != caster) {
- res.result = caster.bytesToMap(dba.get(), fieldSchema);
+ try {
+ res.result = caster.bytesToMap(dba.get(), fieldSchema);
+ } catch(AbstractMethodError e) {
+ // this is for backward compatibility wherein some old LoadCaster
+ // which does not implement bytesToMap(byte[] b, ResourceFieldSchema fieldSchema)
+ // In this case, we only cast bytes to map, but leave the value as bytearray
+ res.result = caster.bytesToMap(dba.get());
+ }
} else {
int errCode = 1075;
String msg = "Received a bytearray from the UDF. Cannot determine how to convert the bytearray to map.";