Author: thejas
Date: Wed Oct 2 22:29:20 2013
New Revision: 1528659
URL: http://svn.apache.org/r1528659
Log:
HIVE-5405 : Need to implement PersistenceDelegate for
org.antlr.runtime.CommonToken (shanyu zhao via Brock Noland)
Modified:
hive/branches/branch-0.12/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java
Modified:
hive/branches/branch-0.12/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java
URL:
http://svn.apache.org/viewvc/hive/branches/branch-0.12/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java?rev=1528659&r1=1528658&r2=1528659&view=diff
==============================================================================
---
hive/branches/branch-0.12/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java
(original)
+++
hive/branches/branch-0.12/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java
Wed Oct 2 22:29:20 2013
@@ -79,6 +79,7 @@ import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.antlr.runtime.CommonToken;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.WordUtils;
import org.apache.commons.logging.Log;
@@ -455,6 +456,18 @@ public final class Utilities {
}
}
+ /**
+ * Need to serialize org.antlr.runtime.CommonToken
+ */
+ public static class CommonTokenDelegate extends PersistenceDelegate {
+ @Override
+ protected Expression instantiate(Object oldInstance, Encoder out) {
+ CommonToken ct = (CommonToken)oldInstance;
+ Object[] args = {ct.getType(), ct.getText()};
+ return new Expression(ct, ct.getClass(), "new", args);
+ }
+ }
+
public static void setMapRedWork(Configuration conf, MapredWork w, String
hiveScratchDir) {
setMapWork(conf, w.getMapWork(), hiveScratchDir, true);
if (w.getReduceWork() != null) {
@@ -648,6 +661,7 @@ public final class Utilities {
e.setPersistenceDelegate(org.datanucleus.store.types.backed.Map.class, new
MapDelegate());
e.setPersistenceDelegate(org.datanucleus.store.types.backed.List.class,
new ListDelegate());
+ e.setPersistenceDelegate(org.antlr.runtime.CommonToken.class, new
CommonTokenDelegate());
e.writeObject(plan);
e.close();