asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From buyin...@apache.org
Subject [3/3] incubator-asterixdb git commit: ASTERIXDB-1198: make ISerializerDeserializer implementations in AsterixDB stateless.
Date Wed, 02 Dec 2015 22:56:23 GMT
ASTERIXDB-1198: make ISerializerDeserializer implementations in AsterixDB stateless.

Change-Id: I808b6583db6b48a0e9000dcf0ac88c03c336c3a5
Reviewed-on: https://asterix-gerrit.ics.uci.edu/522
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Jianfeng Jia <jianfeng.jia@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/commit/9a554a7e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/tree/9a554a7e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/diff/9a554a7e

Branch: refs/heads/master
Commit: 9a554a7e41b004e5ac70b0cbf41f1e4657614a15
Parents: d1bf370
Author: Yingyi Bu <buyingyi@gmail.com>
Authored: Tue Dec 1 20:45:50 2015 -0800
Committer: Yingyi Bu <buyingyi@gmail.com>
Committed: Wed Dec 2 14:51:59 2015 -0800

----------------------------------------------------------------------
 ...IntroduceSecondaryIndexInsertDeleteRule.java |   4 -
 .../asterix/translator/TypeTranslator.java      |  13 +-
 .../external/library/java/JObjectAccessors.java |  18 +-
 .../external/library/java/JObjectUtil.java      |   9 +-
 .../asterix/external/library/java/JObjects.java |   4 +-
 .../library/adapter/TestTypedAdapter.java       |   1 -
 .../adapter/TestTypedAdapterFactory.java        |  21 ---
 .../asterix/metadata/MetadataManager.java       |  22 +--
 .../metadata/bootstrap/MetadataRecordTypes.java | 122 +++---------
 .../DatatypeTupleTranslator.java                |  49 +++--
 .../DatasetNameValueExtractor.java              |  11 +-
 .../DatatypeNameValueExtractor.java             |  13 +-
 .../NestedDatatypeNameValueExtractor.java       |  27 +--
 asterix-om/pom.xml                              |   6 +
 .../serde/ABinarySerializerDeserializer.java    |  11 +-
 .../serde/ACircleSerializerDeserializer.java    |  21 ---
 .../serde/ADateSerializerDeserializer.java      |  27 ---
 .../serde/ADateTimeSerializerDeserializer.java  |  40 ----
 .../ADayTimeDurationSerializerDeserializer.java |  21 +--
 .../serde/ADurationSerializerDeserializer.java  |  22 +--
 .../serde/AInt16SerializerDeserializer.java     |   3 +
 .../serde/AInt8SerializerDeserializer.java      |   3 +
 .../serde/AIntervalSerializerDeserializer.java  | 188 ------------------
 .../serde/ALineSerializerDeserializer.java      |  27 +--
 .../serde/AObjectSerializerDeserializer.java    | 184 ++++++------------
 .../AOrderedListSerializerDeserializer.java     |  51 +++--
 .../serde/APoint3DSerializerDeserializer.java   |  19 --
 .../serde/APointSerializerDeserializer.java     |  17 --
 .../serde/ARecordSerializerDeserializer.java    |  98 +++++-----
 .../serde/ARectangleSerializerDeserializer.java |  35 ----
 .../serde/AStringSerializerDeserializer.java    |  16 +-
 .../serde/ATimeSerializerDeserializer.java      |  23 ---
 .../serde/AUUIDSerializerDeserializer.java      |   3 +
 .../AUnorderedListSerializerDeserializer.java   |  39 ++--
 ...YearMonthDurationSerializerDeserializer.java |  21 +--
 .../AqlSerializerDeserializerProvider.java      |  10 +-
 .../asterix/om/base/ACollectionCursor.java      |   4 +-
 .../apache/asterix/om/base/AOrderedList.java    |  11 +-
 .../org/apache/asterix/om/base/ARecord.java     |  12 +-
 .../apache/asterix/om/base/AUnorderedList.java  |  12 +-
 .../pointables/base/DefaultOpenFieldType.java   |   9 +-
 .../impl/ClosedRecordConstructorResultType.java |  20 +-
 .../impl/NonTaggedLocalAvgTypeComputer.java     |  12 +-
 .../impl/OpenRecordConstructorResultType.java   |  11 +-
 .../impl/RecordConstructorResultType.java       |  11 +-
 .../impl/RecordMergeTypeComputer.java           |   9 +-
 .../apache/asterix/om/types/ARecordType.java    |  10 +-
 .../org/apache/asterix/om/types/AUnionType.java |   9 +-
 .../om/types/AbstractCollectionType.java        |   3 -
 .../apache/asterix/om/types/BuiltinType.java    |  28 ---
 .../AOrderedListSerializerDeserializerTest.java |  52 +++++
 .../ARecordSerializerDeserializerTest.java      |  41 ++++
 ...UnorderedListSerializerDeserializerTest.java |  52 +++++
 .../serde/SerializerDeserializerTestUtils.java  | 145 ++++++++++++++
 .../serde/SimpleSerializerDeserializerTest.java |  64 +++++++
 asterix-runtime/pom.xml                         |   6 +
 ...bstractSerializableAvgAggregateFunction.java |  29 ++-
 .../std/AbstractAvgAggregateFunction.java       |  24 +--
 .../evaluators/functions/IsNullDescriptor.java  |   3 +-
 .../functions/IsSystemNullDescriptor.java       |   6 +-
 .../functions/SpatialIntersectDescriptor.java   | 189 +++++++++----------
 .../records/RecordMergeDescriptor.java          |  23 +--
 .../runtime/operators/file/ADMDataParser.java   |  10 +-
 .../operators/file/AbstractDataParser.java      | 166 ++++++++++++++++
 .../operator/file/ADMDataParserTest.java        | 116 ++++++++++++
 65 files changed, 1116 insertions(+), 1170 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9a554a7e/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceSecondaryIndexInsertDeleteRule.java
----------------------------------------------------------------------
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceSecondaryIndexInsertDeleteRule.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceSecondaryIndexInsertDeleteRule.java
index f5ef424..bb5f659 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceSecondaryIndexInsertDeleteRule.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceSecondaryIndexInsertDeleteRule.java
@@ -50,7 +50,6 @@ import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.om.types.IAType;
 import org.apache.asterix.om.util.NonTaggedFormatUtil;
 import org.apache.commons.lang3.ArrayUtils;
-import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.mutable.Mutable;
 import org.apache.commons.lang3.mutable.MutableObject;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
@@ -505,9 +504,6 @@ public class IntroduceSecondaryIndexInsertDeleteRule implements IAlgebraicRewrit
                     }
                 }
 
-            } catch (AsterixException e) {
-                throw new AlgebricksException(
-                        "Cannot enforce typed fields " + StringUtils.join(index.getKeyFieldNames()), e);
             } catch (IOException e) {
                 throw new AsterixException(e);
             }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9a554a7e/asterix-algebra/src/main/java/org/apache/asterix/translator/TypeTranslator.java
----------------------------------------------------------------------
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/translator/TypeTranslator.java b/asterix-algebra/src/main/java/org/apache/asterix/translator/TypeTranslator.java
index bff41ab..2d405f7 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/translator/TypeTranslator.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/translator/TypeTranslator.java
@@ -30,10 +30,10 @@ import org.apache.asterix.common.annotations.RecordDataGenAnnotation;
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.lang.common.expression.OrderedListTypeDefinition;
 import org.apache.asterix.lang.common.expression.RecordTypeDefinition;
+import org.apache.asterix.lang.common.expression.RecordTypeDefinition.RecordKind;
 import org.apache.asterix.lang.common.expression.TypeExpression;
 import org.apache.asterix.lang.common.expression.TypeReferenceExpression;
 import org.apache.asterix.lang.common.expression.UnorderedListTypeDefinition;
-import org.apache.asterix.lang.common.expression.RecordTypeDefinition.RecordKind;
 import org.apache.asterix.metadata.MetadataException;
 import org.apache.asterix.metadata.MetadataManager;
 import org.apache.asterix.metadata.MetadataTransactionContext;
@@ -49,7 +49,6 @@ import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.om.types.IAType;
 import org.apache.asterix.om.types.TypeSignature;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
 
 public class TypeTranslator {
 
@@ -323,14 +322,8 @@ public class TypeTranslator {
             fldNames[i++] = s;
         }
         boolean isOpen = rtd.getRecordKind() == RecordKind.OPEN;
-        ARecordType recType;
-        try {
-            recType = new ARecordType(typeSignature == null ? null : typeSignature.getName(), fldNames, fldTypes,
-                    isOpen);
-        } catch (HyracksDataException e) {
-            throw new AsterixException(e);
-        }
-
+        ARecordType recType = new ARecordType(typeSignature == null ? null : typeSignature.getName(), fldNames,
+                fldTypes, isOpen);
         List<IRecordFieldDataGen> fieldDataGen = rtd.getFieldDataGen();
         if (fieldDataGen.size() == n) {
             IRecordFieldDataGen[] rfdg = new IRecordFieldDataGen[n];

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9a554a7e/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjectAccessors.java
----------------------------------------------------------------------
diff --git a/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjectAccessors.java b/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjectAccessors.java
index 677e913..29ce728 100644
--- a/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjectAccessors.java
+++ b/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjectAccessors.java
@@ -20,6 +20,7 @@ package org.apache.asterix.external.library.java;
 
 import java.io.ByteArrayInputStream;
 import java.io.DataInputStream;
+import java.io.IOException;
 import java.util.LinkedHashMap;
 import java.util.List;
 
@@ -41,7 +42,6 @@ import org.apache.asterix.dataflow.data.nontagged.serde.APoint3DSerializerDeseri
 import org.apache.asterix.dataflow.data.nontagged.serde.APointSerializerDeserializer;
 import org.apache.asterix.dataflow.data.nontagged.serde.APolygonSerializerDeserializer;
 import org.apache.asterix.dataflow.data.nontagged.serde.ARectangleSerializerDeserializer;
-import org.apache.asterix.dataflow.data.nontagged.serde.AStringSerializerDeserializer;
 import org.apache.asterix.dataflow.data.nontagged.serde.ATimeSerializerDeserializer;
 import org.apache.asterix.external.library.TypeInfo;
 import org.apache.asterix.external.library.java.JObjects.JBoolean;
@@ -86,6 +86,7 @@ import org.apache.asterix.om.types.IAType;
 import org.apache.asterix.om.util.container.IObjectPool;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.util.string.UTF8StringReader;
 
 public class JObjectAccessors {
 
@@ -226,7 +227,7 @@ public class JObjectAccessors {
     }
 
     public static class JStringAccessor implements IJObjectAccessor {
-        private final AStringSerializerDeserializer aStringSerDer = new AStringSerializerDeserializer();
+        private final UTF8StringReader reader = new UTF8StringReader();
 
         @Override
         public IJObject access(IVisitablePointable pointable, IObjectPool<IJObject, IAType> objectPool)
@@ -236,8 +237,11 @@ public class JObjectAccessors {
             int l = pointable.getLength();
 
             String v = null;
-            v = aStringSerDer.deserialize(new DataInputStream(new ByteArrayInputStream(b, s + 1, l - 1)))
-                    .getStringValue();
+            try {
+                v = reader.readUTF(new DataInputStream(new ByteArrayInputStream(b, s + 1, l - 1)));
+            } catch (IOException e) {
+                throw new HyracksDataException(e);
+            }
             JObjectUtil.getNormalizedString(v);
 
             IJObject jObject = objectPool.allocate(BuiltinType.ASTRING);
@@ -444,7 +448,7 @@ public class JObjectAccessors {
         private final JRecord jRecord;
         private final IJObject[] jObjects;
         private final LinkedHashMap<String, IJObject> openFields;
-        private final AStringSerializerDeserializer aStringSerDer = new AStringSerializerDeserializer();
+        private final UTF8StringReader reader = new UTF8StringReader();
 
         public JRecordAccessor(ARecordType recordType, IObjectPool<IJObject, IAType> objectPool) {
             this.typeInfo = new TypeInfo(objectPool, null, null);
@@ -502,9 +506,7 @@ public class JObjectAccessors {
                         byte[] b = fieldName.getByteArray();
                         int s = fieldName.getStartOffset();
                         int l = fieldName.getLength();
-                        String v = aStringSerDer
-                                .deserialize(new DataInputStream(new ByteArrayInputStream(b, s + 1, l - 1)))
-                                .getStringValue();
+                        String v = reader.readUTF(new DataInputStream(new ByteArrayInputStream(b, s + 1, l - 1)));
                         openFields.put(v, fieldObject);
                     }
                     index++;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9a554a7e/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjectUtil.java
----------------------------------------------------------------------
diff --git a/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjectUtil.java b/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjectUtil.java
index b5458e2..146a247 100644
--- a/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjectUtil.java
+++ b/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjectUtil.java
@@ -58,7 +58,6 @@ import org.apache.asterix.om.types.IAType;
 import org.apache.asterix.om.util.NonTaggedFormatUtil;
 import org.apache.asterix.om.util.container.IObjectPool;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
 
 public class JObjectUtil {
 
@@ -392,7 +391,7 @@ public class JObjectUtil {
                         dis.readInt();
                     }
                     for (int i = 0; i < numberOfOpenFields; i++) {
-                        fieldNames[i] = new AStringSerializerDeserializer().deserialize(dis).getStringValue();
+                        fieldNames[i] = AStringSerializerDeserializer.INSTANCE.deserialize(dis).getStringValue();
                         ATypeTag openFieldTypeTag = SerializerDeserializerUtil.deserializeTag(dis);
                         openFields[i] = getJType(openFieldTypeTag, null, dis, objectPool);
                         fieldTypes[i] = openFields[i].getIAObject().getType();
@@ -443,10 +442,6 @@ public class JObjectUtil {
             fieldNames[i] = recType2.getFieldNames()[j];
             fieldTypes[i] = recType2.getFieldTypes()[j];
         }
-        try {
-            return new ARecordType(null, fieldNames, fieldTypes, true);
-        } catch (HyracksDataException e) {
-            throw new AsterixException(e);
-        }
+        return new ARecordType(null, fieldNames, fieldTypes, true);
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9a554a7e/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjects.java
----------------------------------------------------------------------
diff --git a/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjects.java b/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjects.java
index 406d242..e9a63b2 100644
--- a/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjects.java
+++ b/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjects.java
@@ -366,7 +366,7 @@ public class JObjects {
 
     public static final class JString extends JObject {
 
-        private final AStringSerializerDeserializer aStringSerDer = new AStringSerializerDeserializer();
+        private final AStringSerializerDeserializer aStringSerDer = AStringSerializerDeserializer.INSTANCE;
 
         public JString(String v) {
             super(new AMutableString(v));
@@ -978,7 +978,7 @@ public class JObjects {
         private ARecordType recordType;
         private IJObject[] fields;
         private Map<String, IJObject> openFields;
-        private final AStringSerializerDeserializer aStringSerDer = new AStringSerializerDeserializer();
+        private final AStringSerializerDeserializer aStringSerDer = AStringSerializerDeserializer.INSTANCE;
 
         public JRecord(ARecordType recordType, IJObject[] fields) {
             this.recordType = recordType;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9a554a7e/asterix-external-data/src/test/java/org/apache/asterix/external/library/adapter/TestTypedAdapter.java
----------------------------------------------------------------------
diff --git a/asterix-external-data/src/test/java/org/apache/asterix/external/library/adapter/TestTypedAdapter.java b/asterix-external-data/src/test/java/org/apache/asterix/external/library/adapter/TestTypedAdapter.java
index 70f05bd..39f8271 100644
--- a/asterix-external-data/src/test/java/org/apache/asterix/external/library/adapter/TestTypedAdapter.java
+++ b/asterix-external-data/src/test/java/org/apache/asterix/external/library/adapter/TestTypedAdapter.java
@@ -28,7 +28,6 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
 import org.apache.asterix.common.feeds.api.IFeedAdapter;
-import org.apache.asterix.common.feeds.api.IFeedAdapter.DataExchangeMode;
 import org.apache.asterix.external.dataset.adapter.StreamBasedAdapter;
 import org.apache.asterix.om.types.ARecordType;
 import org.apache.hyracks.api.comm.IFrameWriter;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9a554a7e/asterix-external-data/src/test/java/org/apache/asterix/external/library/adapter/TestTypedAdapterFactory.java
----------------------------------------------------------------------
diff --git a/asterix-external-data/src/test/java/org/apache/asterix/external/library/adapter/TestTypedAdapterFactory.java b/asterix-external-data/src/test/java/org/apache/asterix/external/library/adapter/TestTypedAdapterFactory.java
index 17e14c5..0100ea1 100644
--- a/asterix-external-data/src/test/java/org/apache/asterix/external/library/adapter/TestTypedAdapterFactory.java
+++ b/asterix-external-data/src/test/java/org/apache/asterix/external/library/adapter/TestTypedAdapterFactory.java
@@ -20,28 +20,19 @@ package org.apache.asterix.external.library.adapter;
 
 import java.util.Map;
 
-import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.common.feeds.api.IDatasourceAdapter;
 import org.apache.asterix.common.feeds.api.IIntakeProgressTracker;
-import org.apache.asterix.metadata.entities.DatasourceAdapter.AdapterType;
-import org.apache.asterix.metadata.external.IAdapterFactory.SupportedOperation;
 import org.apache.asterix.metadata.feeds.IFeedAdapterFactory;
 import org.apache.asterix.om.types.ARecordType;
-import org.apache.asterix.om.types.BuiltinType;
-import org.apache.asterix.om.types.IAType;
 import org.apache.asterix.runtime.operators.file.AsterixTupleParserFactory;
 import org.apache.asterix.runtime.operators.file.AsterixTupleParserFactory.InputDataFormat;
 import org.apache.hyracks.algebricks.common.constraints.AlgebricksCountPartitionConstraint;
 import org.apache.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint;
 import org.apache.hyracks.api.context.IHyracksTaskContext;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.dataflow.std.file.ITupleParserFactory;
 
 public class TestTypedAdapterFactory implements IFeedAdapterFactory {
 
-    /**
-     * 
-     */
     private static final long serialVersionUID = 1L;
 
     public static final String NAME = "test_typed_adapter";
@@ -57,18 +48,6 @@ public class TestTypedAdapterFactory implements IFeedAdapterFactory {
         return SupportedOperation.READ;
     }
 
-    private static ARecordType initOutputType() {
-        String[] fieldNames = new String[] { "id", "message-text" };
-        IAType[] fieldTypes = new IAType[] { BuiltinType.AINT64, BuiltinType.ASTRING };
-        ARecordType outputType = null;
-        try {
-            outputType = new ARecordType("TestTypedAdapterOutputType", fieldNames, fieldTypes, false);
-        } catch (AsterixException | HyracksDataException exception) {
-            throw new IllegalStateException("Unable to create output type for adapter " + NAME);
-        }
-        return outputType;
-    }
-
     @Override
     public String getName() {
         return NAME;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9a554a7e/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataManager.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataManager.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataManager.java
index cb409d5..602cb4c 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataManager.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataManager.java
@@ -27,7 +27,6 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 import org.apache.asterix.common.config.AsterixMetadataProperties;
 import org.apache.asterix.common.exceptions.ACIDException;
-import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.common.functions.FunctionSignature;
 import org.apache.asterix.common.transactions.JobId;
 import org.apache.asterix.metadata.api.IAsterixStateProxy;
@@ -48,7 +47,6 @@ import org.apache.asterix.metadata.entities.Node;
 import org.apache.asterix.metadata.entities.NodeGroup;
 import org.apache.asterix.om.types.ARecordType;
 import org.apache.asterix.transaction.management.service.transaction.JobIdFactory;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
 
 /**
  * Provides access to Asterix metadata via remote methods to the metadata node.
@@ -428,18 +426,14 @@ public class MetadataManager implements IMetadataManager {
         datatype = cache.getDatatype(dataverseName, datatypeName);
         if (datatype != null) {
             // Datatype is already in the cache, don't add it again.
-            try {
-                //create a new Datatype object with a new ARecordType object in order to avoid
-                //concurrent access to UTF8StringPointable comparator in ARecordType object.
-                //see issue 510
-                ARecordType aRecType = (ARecordType) datatype.getDatatype();
-                return new Datatype(
-                        datatype.getDataverseName(), datatype.getDatatypeName(), new ARecordType(aRecType.getTypeName(),
-                                aRecType.getFieldNames(), aRecType.getFieldTypes(), aRecType.isOpen()),
-                        datatype.getIsAnonymous());
-            } catch (AsterixException | HyracksDataException e) {
-                throw new MetadataException(e);
-            }
+            //create a new Datatype object with a new ARecordType object in order to avoid
+            //concurrent access to UTF8StringPointable comparator in ARecordType object.
+            //see issue 510
+            ARecordType aRecType = (ARecordType) datatype.getDatatype();
+            return new Datatype(
+                    datatype.getDataverseName(), datatype.getDatatypeName(), new ARecordType(aRecType.getTypeName(),
+                            aRecType.getFieldNames(), aRecType.getFieldTypes(), aRecType.isOpen()),
+                    datatype.getIsAnonymous());
         }
         try {
             datatype = metadataNode.getDatatype(ctx.getJobId(), dataverseName, datatypeName);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9a554a7e/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataRecordTypes.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataRecordTypes.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataRecordTypes.java
index df48269..fe42a2c 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataRecordTypes.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataRecordTypes.java
@@ -134,11 +134,7 @@ public final class MetadataRecordTypes {
         AUnorderedListType listPropertiesType = new AUnorderedListType(POLICY_PARAMS_RECORDTYPE, null);
         String[] fieldNames = { "DataverseName", "PolicyName", "Description", "Properties" };
         IAType[] fieldTypes = { BuiltinType.ASTRING, BuiltinType.ASTRING, BuiltinType.ASTRING, listPropertiesType };
-        try {
-            return new ARecordType("FeedPolicyRecordType", fieldNames, fieldTypes, true);
-        } catch (HyracksDataException e) {
-            throw new AsterixException(e);
-        }
+        return new ARecordType("FeedPolicyRecordType", fieldNames, fieldTypes, true);
     }
 
     // Helper constants for accessing fields in an ARecord of type
@@ -149,14 +145,10 @@ public final class MetadataRecordTypes {
     public static final int DATAVERSE_ARECORD_PENDINGOP_FIELD_INDEX = 3;
 
     private static final ARecordType createDataverseRecordType() throws AsterixException {
-        try {
-            return new ARecordType("DataverseRecordType",
-                    new String[] { "DataverseName", "DataFormat", "Timestamp", "PendingOp" },
-                    new IAType[] { BuiltinType.ASTRING, BuiltinType.ASTRING, BuiltinType.ASTRING, BuiltinType.AINT32 },
-                    true);
-        } catch (HyracksDataException e) {
-            throw new AsterixException(e);
-        }
+        return new ARecordType("DataverseRecordType",
+                new String[] { "DataverseName", "DataFormat", "Timestamp", "PendingOp" },
+                new IAType[] { BuiltinType.ASTRING, BuiltinType.ASTRING, BuiltinType.ASTRING, BuiltinType.AINT32 },
+                true);
     }
 
     // Helper constants for accessing fields in an ARecord of anonymous type
@@ -168,11 +160,7 @@ public final class MetadataRecordTypes {
     private static final ARecordType createPropertiesRecordType() throws AsterixException {
         String[] fieldNames = { "Name", "Value" };
         IAType[] fieldTypes = { BuiltinType.ASTRING, BuiltinType.ASTRING };
-        try {
-            return new ARecordType(null, fieldNames, fieldTypes, true);
-        } catch (HyracksDataException e) {
-            throw new AsterixException(e);
-        }
+        return new ARecordType(null, fieldNames, fieldTypes, true);
     };
 
     // Helper constants for accessing fields in an ARecord of anonymous type
@@ -189,11 +177,7 @@ public final class MetadataRecordTypes {
         String[] fieldNames = { "FileStructure", "PartitioningStrategy", "PartitioningKey", "PrimaryKey",
                 "Autogenerated" };
         IAType[] fieldTypes = { BuiltinType.ASTRING, BuiltinType.ASTRING, ololType, ololType, BuiltinType.ABOOLEAN };
-        try {
-            return new ARecordType(null, fieldNames, fieldTypes, true);
-        } catch (HyracksDataException e) {
-            throw new AsterixException(e);
-        }
+        return new ARecordType(null, fieldNames, fieldTypes, true);
     }
 
     // Helper constants for accessing fields in an ARecord of anonymous type
@@ -208,11 +192,7 @@ public final class MetadataRecordTypes {
         String[] fieldNames = { "DatasourceAdapter", "Properties", "LastRefreshTime", "TransactionState", };
         IAType[] fieldTypes = { BuiltinType.ASTRING, orderedPropertyListType, BuiltinType.ADATETIME,
                 BuiltinType.AINT32 };
-        try {
-            return new ARecordType(null, fieldNames, fieldTypes, true);
-        } catch (HyracksDataException e) {
-            throw new AsterixException(e);
-        }
+        return new ARecordType(null, fieldNames, fieldTypes, true);
     }
 
     public static final int COMPACTION_POLICY_ARECORD_DATAVERSE_NAME_FIELD_INDEX = 0;
@@ -222,11 +202,7 @@ public final class MetadataRecordTypes {
     private static ARecordType createCompactionPolicyRecordType() throws AsterixException {
         String[] fieldNames = { "DataverseName", "CompactionPolicy", "Classname" };
         IAType[] fieldTypes = { BuiltinType.ASTRING, BuiltinType.ASTRING, BuiltinType.ASTRING };
-        try {
-            return new ARecordType("CompactionPolicyRecordType", fieldNames, fieldTypes, true);
-        } catch (HyracksDataException e) {
-            throw new AsterixException(e);
-        }
+        return new ARecordType("CompactionPolicyRecordType", fieldNames, fieldTypes, true);
     }
 
     public static final int FEED_DETAILS_ARECORD_FILESTRUCTURE_FIELD_INDEX = 0;
@@ -256,12 +232,7 @@ public final class MetadataRecordTypes {
         IAType[] fieldTypes = { BuiltinType.ASTRING, BuiltinType.ASTRING, orderedListType, orderedListType,
                 BuiltinType.ASTRING, BuiltinType.ASTRING, orderedListOfPropertiesType, feedFunctionUnion,
                 BuiltinType.ASTRING, BuiltinType.ASTRING, compactionPolicyPropertyListType };
-
-        try {
-            return new ARecordType(null, fieldNames, fieldTypes, true);
-        } catch (HyracksDataException e) {
-            throw new AsterixException(e);
-        }
+        return new ARecordType(null, fieldNames, fieldTypes, true);
     }
 
     public static final int DATASET_ARECORD_DATAVERSENAME_FIELD_INDEX = 0;
@@ -294,11 +265,7 @@ public final class MetadataRecordTypes {
                 BuiltinType.ASTRING, BuiltinType.ASTRING, compactionPolicyPropertyListType, internalRecordUnion,
                 externalRecordUnion, unorderedListOfHintsType, BuiltinType.ASTRING, BuiltinType.AINT32,
                 BuiltinType.AINT32 };
-        try {
-            return new ARecordType("DatasetRecordType", fieldNames, fieldTypes, true);
-        } catch (HyracksDataException e) {
-            throw new AsterixException(e);
-        }
+        return new ARecordType("DatasetRecordType", fieldNames, fieldTypes, true);
     }
 
     // Helper constants for accessing fields in an ARecord of anonymous type
@@ -310,11 +277,7 @@ public final class MetadataRecordTypes {
     private static final ARecordType createFieldRecordType() throws AsterixException {
         String[] fieldNames = { "FieldName", "FieldType", "IsNullable" };
         IAType[] fieldTypes = { BuiltinType.ASTRING, BuiltinType.ASTRING, BuiltinType.ABOOLEAN };
-        try {
-            return new ARecordType(null, fieldNames, fieldTypes, true);
-        } catch (HyracksDataException e) {
-            throw new AsterixException(e);
-        }
+        return new ARecordType(null, fieldNames, fieldTypes, true);
     };
 
     // Helper constants for accessing fields in an ARecord of anonymous type
@@ -326,11 +289,7 @@ public final class MetadataRecordTypes {
         AOrderedListType olType = new AOrderedListType(FIELD_RECORDTYPE, null);
         String[] fieldNames = { "IsOpen", "Fields" };
         IAType[] fieldTypes = { BuiltinType.ABOOLEAN, olType };
-        try {
-            return new ARecordType(null, fieldNames, fieldTypes, true);
-        } catch (HyracksDataException e) {
-            throw new AsterixException(e);
-        }
+        return new ARecordType(null, fieldNames, fieldTypes, true);
     };
 
     // Helper constants for accessing fields in an ARecord of anonymous type
@@ -348,11 +307,7 @@ public final class MetadataRecordTypes {
 
         IAType[] fieldTypes = { BuiltinType.ASTRING, BuiltinType.ABOOLEAN, recordUnion, collectionUnion,
                 collectionUnion };
-        try {
-            return new ARecordType(null, fieldNames, fieldTypes, true);
-        } catch (HyracksDataException e) {
-            throw new AsterixException(e);
-        }
+        return new ARecordType(null, fieldNames, fieldTypes, true);
     };
 
     // Helper constants for accessing fields in an ARecord of type
@@ -366,11 +321,7 @@ public final class MetadataRecordTypes {
         String[] fieldNames = { "DataverseName", "DatatypeName", "Derived", "Timestamp" };
         AUnionType recordUnion = AUnionType.createNullableType(DERIVEDTYPE_RECORDTYPE);
         IAType[] fieldTypes = { BuiltinType.ASTRING, BuiltinType.ASTRING, recordUnion, BuiltinType.ASTRING };
-        try {
-            return new ARecordType("DatatypeRecordType", fieldNames, fieldTypes, true);
-        } catch (HyracksDataException e) {
-            throw new AsterixException(e);
-        }
+        return new ARecordType("DatatypeRecordType", fieldNames, fieldTypes, true);
     };
 
     // Helper constants for accessing fields in an ARecord of type
@@ -391,11 +342,7 @@ public final class MetadataRecordTypes {
                 "Timestamp", "PendingOp" };
         IAType[] fieldTypes = { BuiltinType.ASTRING, BuiltinType.ASTRING, BuiltinType.ASTRING, BuiltinType.ASTRING,
                 ololType, BuiltinType.ABOOLEAN, BuiltinType.ASTRING, BuiltinType.AINT32 };
-        try {
-            return new ARecordType("IndexRecordType", fieldNames, fieldTypes, true);
-        } catch (HyracksDataException e) {
-            throw new AsterixException(e);
-        }
+        return new ARecordType("IndexRecordType", fieldNames, fieldTypes, true);
     };
 
     // Helper constants for accessing fields in an ARecord of type
@@ -407,11 +354,7 @@ public final class MetadataRecordTypes {
     private static final ARecordType createNodeRecordType() throws AsterixException {
         String[] fieldNames = { "NodeName", "NumberOfCores", "WorkingMemorySize" };
         IAType[] fieldTypes = { BuiltinType.ASTRING, BuiltinType.AINT64, BuiltinType.AINT64 };
-        try {
-            return new ARecordType("NodeRecordType", fieldNames, fieldTypes, true);
-        } catch (HyracksDataException e) {
-            throw new AsterixException(e);
-        }
+        return new ARecordType("NodeRecordType", fieldNames, fieldTypes, true);
     };
 
     // Helper constants for accessing fields in an ARecord of type
@@ -424,11 +367,7 @@ public final class MetadataRecordTypes {
         AUnorderedListType ulType = new AUnorderedListType(BuiltinType.ASTRING, null);
         String[] fieldNames = { "GroupName", "NodeNames", "Timestamp" };
         IAType[] fieldTypes = { BuiltinType.ASTRING, ulType, BuiltinType.ASTRING };
-        try {
-            return new ARecordType("NodeGroupRecordType", fieldNames, fieldTypes, true);
-        } catch (HyracksDataException e) {
-            throw new AsterixException(e);
-        }
+        return new ARecordType("NodeGroupRecordType", fieldNames, fieldTypes, true);
     };
 
     private static IAType createFunctionParamsRecordType() {
@@ -447,17 +386,12 @@ public final class MetadataRecordTypes {
     public static final int FUNCTION_ARECORD_FUNCTION_KIND_FIELD_INDEX = 7;
 
     private static final ARecordType createFunctionRecordType() throws AsterixException {
-
         String[] fieldNames = { "DataverseName", "Name", "Arity", "Params", "ReturnType", "Definition", "Language",
                 "Kind" };
         IAType[] fieldTypes = { BuiltinType.ASTRING, BuiltinType.ASTRING, BuiltinType.ASTRING,
                 createFunctionParamsRecordType(), BuiltinType.ASTRING, BuiltinType.ASTRING, BuiltinType.ASTRING,
                 BuiltinType.ASTRING };
-        try {
-            return new ARecordType("FunctionRecordType", fieldNames, fieldTypes, true);
-        } catch (HyracksDataException e) {
-            throw new AsterixException(e);
-        }
+        return new ARecordType("FunctionRecordType", fieldNames, fieldTypes, true);
     }
 
     public static final int DATASOURCE_ADAPTER_ARECORD_DATAVERSENAME_FIELD_INDEX = 0;
@@ -470,11 +404,7 @@ public final class MetadataRecordTypes {
         String[] fieldNames = { "DataverseName", "Name", "Classname", "Type", "Timestamp" };
         IAType[] fieldTypes = { BuiltinType.ASTRING, BuiltinType.ASTRING, BuiltinType.ASTRING, BuiltinType.ASTRING,
                 BuiltinType.ASTRING };
-        try {
-            return new ARecordType("DatasourceAdapterRecordType", fieldNames, fieldTypes, true);
-        } catch (HyracksDataException e) {
-            throw new AsterixException(e);
-        }
+        return new ARecordType("DatasourceAdapterRecordType", fieldNames, fieldTypes, true);
     }
 
     // Helper constants for accessing fields in an ARecord of type
@@ -543,11 +473,7 @@ public final class MetadataRecordTypes {
     private static ARecordType createLibraryRecordType() throws AsterixException {
         String[] fieldNames = { "DataverseName", "Name", "Timestamp" };
         IAType[] fieldTypes = { BuiltinType.ASTRING, BuiltinType.ASTRING, BuiltinType.ASTRING };
-        try {
-            return new ARecordType("LibraryRecordType", fieldNames, fieldTypes, true);
-        } catch (HyracksDataException e) {
-            throw new AsterixException(e);
-        }
+        return new ARecordType("LibraryRecordType", fieldNames, fieldTypes, true);
     }
 
     public static final int EXTERNAL_FILE_ARECORD_DATAVERSENAME_FIELD_INDEX = 0;
@@ -563,10 +489,6 @@ public final class MetadataRecordTypes {
                 "PendingOp" };
         IAType[] fieldTypes = { BuiltinType.ASTRING, BuiltinType.ASTRING, BuiltinType.AINT32, BuiltinType.ASTRING,
                 BuiltinType.AINT64, BuiltinType.ADATETIME, BuiltinType.AINT32 };
-        try {
-            return new ARecordType("ExternalFileRecordType", fieldNames, fieldTypes, true);
-        } catch (HyracksDataException e) {
-            throw new AsterixException(e);
-        }
+        return new ARecordType("ExternalFileRecordType", fieldNames, fieldTypes, true);
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9a554a7e/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/DatatypeTupleTranslator.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/DatatypeTupleTranslator.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/DatatypeTupleTranslator.java
index 9a33f93..8948f43 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/DatatypeTupleTranslator.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/DatatypeTupleTranslator.java
@@ -95,7 +95,7 @@ public class DatatypeTupleTranslator extends AbstractTupleTranslator<Datatype> {
         int recordLength = frameTuple.getFieldLength(DATATYPE_PAYLOAD_TUPLE_FIELD_INDEX);
         ByteArrayInputStream stream = new ByteArrayInputStream(serRecord, recordStartOffset, recordLength);
         DataInput in = new DataInputStream(stream);
-        ARecord datatypeRecord = (ARecord) recordSerDes.deserialize(in);
+        ARecord datatypeRecord = recordSerDes.deserialize(in);
         return createDataTypeFromARecord(datatypeRecord);
     }
 
@@ -109,8 +109,9 @@ public class DatatypeTupleTranslator extends AbstractTupleTranslator<Datatype> {
             // Derived Type
             ARecord derivedTypeRecord = (ARecord) datatypeRecord
                     .getValueByPos(MetadataRecordTypes.DATATYPE_ARECORD_DERIVED_FIELD_INDEX);
-            DerivedTypeTag tag = DerivedTypeTag.valueOf(((AString) derivedTypeRecord
-                    .getValueByPos(MetadataRecordTypes.DERIVEDTYPE_ARECORD_TAG_FIELD_INDEX)).getStringValue());
+            DerivedTypeTag tag = DerivedTypeTag.valueOf(
+                    ((AString) derivedTypeRecord.getValueByPos(MetadataRecordTypes.DERIVEDTYPE_ARECORD_TAG_FIELD_INDEX))
+                            .getStringValue());
             boolean isAnonymous = ((ABoolean) derivedTypeRecord
                     .getValueByPos(MetadataRecordTypes.DERIVEDTYPE_ARECORD_ISANONYMOUS_FIELD_INDEX)).getBoolean();
             switch (tag) {
@@ -119,7 +120,7 @@ public class DatatypeTupleTranslator extends AbstractTupleTranslator<Datatype> {
                             .getValueByPos(MetadataRecordTypes.DERIVEDTYPE_ARECORD_RECORD_FIELD_INDEX);
                     boolean isOpen = ((ABoolean) recordType
                             .getValueByPos(MetadataRecordTypes.RECORDTYPE_ARECORD_ISOPEN_FIELD_INDEX)).getBoolean()
-                            .booleanValue();
+                                    .booleanValue();
                     int numberOfFields = ((AOrderedList) recordType
                             .getValueByPos(MetadataRecordTypes.RECORDTYPE_ARECORD_FIELDS_FIELD_INDEX)).size();
                     IACursor cursor = ((AOrderedList) recordType
@@ -132,39 +133,37 @@ public class DatatypeTupleTranslator extends AbstractTupleTranslator<Datatype> {
                         ARecord field = (ARecord) cursor.get();
                         fieldNames[fieldId] = ((AString) field
                                 .getValueByPos(MetadataRecordTypes.FIELD_ARECORD_FIELDNAME_FIELD_INDEX))
-                                .getStringValue();
+                                        .getStringValue();
                         fieldTypeName = ((AString) field
                                 .getValueByPos(MetadataRecordTypes.FIELD_ARECORD_FIELDTYPE_FIELD_INDEX))
-                                .getStringValue();
+                                        .getStringValue();
                         boolean isNullable = ((ABoolean) field
                                 .getValueByPos(MetadataRecordTypes.FIELD_ARECORD_ISNULLABLE_FIELD_INDEX)).getBoolean()
-                                .booleanValue();
+                                        .booleanValue();
                         fieldTypes[fieldId] = AsterixBuiltinTypeMap.getTypeFromTypeName(metadataNode, jobId,
                                 dataverseName, fieldTypeName, isNullable);
                         fieldId++;
                     }
-                    try {
-                        return new Datatype(dataverseName, datatypeName, new ARecordType(datatypeName, fieldNames,
-                                fieldTypes, isOpen), isAnonymous);
-                    } catch (AsterixException | HyracksDataException e) {
-                        throw new MetadataException(e);
-                    }
+                    return new Datatype(dataverseName, datatypeName,
+                            new ARecordType(datatypeName, fieldNames, fieldTypes, isOpen), isAnonymous);
                 }
                 case UNORDEREDLIST: {
                     String unorderedlistTypeName = ((AString) derivedTypeRecord
                             .getValueByPos(MetadataRecordTypes.DERIVEDTYPE_ARECORD_UNORDEREDLIST_FIELD_INDEX))
-                            .getStringValue();
-                    return new Datatype(dataverseName, datatypeName, new AUnorderedListType(
-                            AsterixBuiltinTypeMap.getTypeFromTypeName(metadataNode, jobId, dataverseName,
-                                    unorderedlistTypeName, false), datatypeName), isAnonymous);
+                                    .getStringValue();
+                    return new Datatype(dataverseName, datatypeName,
+                            new AUnorderedListType(AsterixBuiltinTypeMap.getTypeFromTypeName(metadataNode, jobId,
+                                    dataverseName, unorderedlistTypeName, false), datatypeName),
+                            isAnonymous);
                 }
                 case ORDEREDLIST: {
                     String orderedlistTypeName = ((AString) derivedTypeRecord
                             .getValueByPos(MetadataRecordTypes.DERIVEDTYPE_ARECORD_ORDEREDLIST_FIELD_INDEX))
-                            .getStringValue();
-                    return new Datatype(dataverseName, datatypeName, new AOrderedListType(
-                            AsterixBuiltinTypeMap.getTypeFromTypeName(metadataNode, jobId, dataverseName,
-                                    orderedlistTypeName, false), datatypeName), isAnonymous);
+                                    .getStringValue();
+                    return new Datatype(dataverseName, datatypeName,
+                            new AOrderedListType(AsterixBuiltinTypeMap.getTypeFromTypeName(metadataNode, jobId,
+                                    dataverseName, orderedlistTypeName, false), datatypeName),
+                            isAnonymous);
                 }
                 default:
                     throw new UnsupportedOperationException("Unsupported derived type: " + tag);
@@ -250,8 +249,8 @@ public class DatatypeTupleTranslator extends AbstractTupleTranslator<Datatype> {
                 tag = DerivedTypeTag.RECORD;
                 break;
             default:
-                throw new UnsupportedOperationException("No metadata record Type for "
-                        + derivedDatatype.getDisplayName());
+                throw new UnsupportedOperationException(
+                        "No metadata record Type for " + derivedDatatype.getDisplayName());
         }
 
         derivedRecordBuilder.reset(MetadataRecordTypes.DERIVEDTYPE_RECORDTYPE);
@@ -300,8 +299,8 @@ public class DatatypeTupleTranslator extends AbstractTupleTranslator<Datatype> {
         stringSerde.serialize(aString, out);
     }
 
-    private void writeRecordType(Datatype instance, AbstractComplexType type, DataOutput out) throws IOException,
-            AsterixException {
+    private void writeRecordType(Datatype instance, AbstractComplexType type, DataOutput out)
+            throws IOException, AsterixException {
 
         ArrayBackedValueStorage fieldValue = new ArrayBackedValueStorage();
         ArrayBackedValueStorage itemValue = new ArrayBackedValueStorage();

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9a554a7e/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/DatasetNameValueExtractor.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/DatasetNameValueExtractor.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/DatasetNameValueExtractor.java
index e81da3f..ef3ac49 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/DatasetNameValueExtractor.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/DatasetNameValueExtractor.java
@@ -24,19 +24,18 @@ import java.io.DataInput;
 import java.io.DataInputStream;
 
 import org.apache.asterix.common.transactions.JobId;
-import org.apache.asterix.dataflow.data.nontagged.serde.AObjectSerializerDeserializer;
 import org.apache.asterix.metadata.MetadataException;
 import org.apache.asterix.metadata.api.IValueExtractor;
-import org.apache.asterix.om.base.AString;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference;
+import org.apache.hyracks.util.string.UTF8StringReader;
 
 /**
  * Extracts the value of field 'DatasetName' from an ITupleReference that
  * contains a serialized representation of a Dataset metadata entity.
  */
 public class DatasetNameValueExtractor implements IValueExtractor<String> {
-    private final AObjectSerializerDeserializer aObjSerDer = new AObjectSerializerDeserializer();
+    private final UTF8StringReader reader = new UTF8StringReader();
 
     @Override
     public String getValue(JobId jobId, ITupleReference tuple) throws MetadataException, HyracksDataException {
@@ -45,6 +44,10 @@ public class DatasetNameValueExtractor implements IValueExtractor<String> {
         int recordLength = tuple.getFieldLength(2);
         ByteArrayInputStream stream = new ByteArrayInputStream(serRecord, recordStartOffset, recordLength);
         DataInput in = new DataInputStream(stream);
-        return (((AString) aObjSerDer.deserialize(in)).getStringValue());
+        try {
+            return reader.readUTF(in);
+        } catch (Exception e) {
+            throw new HyracksDataException(e);
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9a554a7e/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/DatatypeNameValueExtractor.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/DatatypeNameValueExtractor.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/DatatypeNameValueExtractor.java
index 9a50a31..edb3d2e 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/DatatypeNameValueExtractor.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/DatatypeNameValueExtractor.java
@@ -22,16 +22,15 @@ package org.apache.asterix.metadata.valueextractors;
 import java.io.ByteArrayInputStream;
 import java.io.DataInput;
 import java.io.DataInputStream;
-import java.rmi.RemoteException;
+import java.io.IOException;
 
 import org.apache.asterix.common.transactions.JobId;
-import org.apache.asterix.dataflow.data.nontagged.serde.AObjectSerializerDeserializer;
 import org.apache.asterix.metadata.MetadataException;
 import org.apache.asterix.metadata.MetadataNode;
 import org.apache.asterix.metadata.api.IValueExtractor;
-import org.apache.asterix.om.base.AString;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference;
+import org.apache.hyracks.util.string.UTF8StringReader;
 
 /**
  * Extracts the value of field 'DataypeName' from an ITupleReference that
@@ -40,7 +39,7 @@ import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference;
 public class DatatypeNameValueExtractor implements IValueExtractor<String> {
     private final String dataverseName;
     private final MetadataNode metadataNode;
-    private final AObjectSerializerDeserializer aObjSerDer = new AObjectSerializerDeserializer();
+    private final UTF8StringReader reader = new UTF8StringReader();
 
     public DatatypeNameValueExtractor(String dataverseName, MetadataNode metadataNode) {
         this.dataverseName = dataverseName;
@@ -54,16 +53,16 @@ public class DatatypeNameValueExtractor implements IValueExtractor<String> {
         int recordLength = tuple.getFieldLength(2);
         ByteArrayInputStream stream = new ByteArrayInputStream(serRecord, recordStartOffset, recordLength);
         DataInput in = new DataInputStream(stream);
-        String typeName = ((AString) aObjSerDer.deserialize(in)).getStringValue();
         try {
+            String typeName = reader.readUTF(in);
             if (metadataNode.getDatatype(jobId, dataverseName, typeName).getIsAnonymous()) {
                 // Get index 0 because it is anonymous type, and it is used in
                 // only one non-anonymous type.
                 typeName = metadataNode.getDatatypeNamesUsingThisDatatype(jobId, dataverseName, typeName).get(0);
             }
-        } catch (RemoteException e) {
+            return typeName;
+        } catch (IOException e) {
             throw new MetadataException(e);
         }
-        return typeName;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9a554a7e/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/NestedDatatypeNameValueExtractor.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/NestedDatatypeNameValueExtractor.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/NestedDatatypeNameValueExtractor.java
index 41d92c9..bdc36e8 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/NestedDatatypeNameValueExtractor.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/NestedDatatypeNameValueExtractor.java
@@ -22,14 +22,14 @@ package org.apache.asterix.metadata.valueextractors;
 import java.io.ByteArrayInputStream;
 import java.io.DataInput;
 import java.io.DataInputStream;
+import java.io.IOException;
 
 import org.apache.asterix.common.transactions.JobId;
-import org.apache.asterix.dataflow.data.nontagged.serde.AObjectSerializerDeserializer;
 import org.apache.asterix.metadata.MetadataException;
 import org.apache.asterix.metadata.api.IValueExtractor;
-import org.apache.asterix.om.base.AString;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference;
+import org.apache.hyracks.util.string.UTF8StringReader;
 
 /**
  * Extracts the value of field 'DataypeName' of the first nested type from an
@@ -43,7 +43,8 @@ public class NestedDatatypeNameValueExtractor implements IValueExtractor<String>
     public NestedDatatypeNameValueExtractor(String datatypeName) {
         this.datatypeName = datatypeName;
     }
-    private final AObjectSerializerDeserializer aObjSerDer = new AObjectSerializerDeserializer();
+
+    private final UTF8StringReader reader = new UTF8StringReader();
 
     @Override
     public String getValue(JobId jobId, ITupleReference tuple) throws MetadataException, HyracksDataException {
@@ -52,14 +53,18 @@ public class NestedDatatypeNameValueExtractor implements IValueExtractor<String>
         int recordLength = tuple.getFieldLength(2);
         ByteArrayInputStream stream = new ByteArrayInputStream(serRecord, recordStartOffset, recordLength);
         DataInput in = new DataInputStream(stream);
-        String nestedType = ((AString) aObjSerDer.deserialize(in)).getStringValue();
-        if (nestedType.equals(datatypeName)) {
-            recordStartOffset = tuple.getFieldStart(1);
-            recordLength = tuple.getFieldLength(1);
-            stream = new ByteArrayInputStream(serRecord, recordStartOffset, recordLength);
-            in = new DataInputStream(stream);
-            return ((AString) aObjSerDer.deserialize(in)).getStringValue();
+        try {
+            String nestedType = reader.readUTF(in);
+            if (nestedType.equals(datatypeName)) {
+                recordStartOffset = tuple.getFieldStart(1);
+                recordLength = tuple.getFieldLength(1);
+                stream = new ByteArrayInputStream(serRecord, recordStartOffset, recordLength);
+                in = new DataInputStream(stream);
+                return reader.readUTF(in);
+            }
+            return null;
+        } catch (IOException e) {
+            throw new HyracksDataException(e);
         }
-        return null;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9a554a7e/asterix-om/pom.xml
----------------------------------------------------------------------
diff --git a/asterix-om/pom.xml b/asterix-om/pom.xml
index 7e42853..e16a7da 100644
--- a/asterix-om/pom.xml
+++ b/asterix-om/pom.xml
@@ -59,5 +59,11 @@
 			<groupId>org.apache.hyracks</groupId>
 			<artifactId>hyracks-storage-am-lsm-rtree</artifactId>
 		</dependency>
+		<dependency>
+        <groupId>org.reflections</groupId>
+            <artifactId>reflections</artifactId>
+            <version>0.9.10</version>
+            <scope>test</scope>
+        </dependency>
 	</dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9a554a7e/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ABinarySerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ABinarySerializerDeserializer.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ABinarySerializerDeserializer.java
index 3bde3b3..ee180bf 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ABinarySerializerDeserializer.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ABinarySerializerDeserializer.java
@@ -30,19 +30,20 @@ import org.apache.hyracks.dataflow.common.data.marshalling.ByteArraySerializerDe
 public class ABinarySerializerDeserializer implements ISerializerDeserializer<ABinary> {
 
     private static final long serialVersionUID = 1L;
+    public static final ABinarySerializerDeserializer INSTANCE = new ABinarySerializerDeserializer();
 
-    public ABinarySerializerDeserializer() {}
-
-    private ByteArraySerializerDeserializer byteArrayPtrSerDer = new ByteArraySerializerDeserializer();
+    private ABinarySerializerDeserializer() {
+    }
 
     @Override
     public ABinary deserialize(DataInput in) throws HyracksDataException {
-        return new ABinary(byteArrayPtrSerDer.deserialize(in));
+        return new ABinary(ByteArraySerializerDeserializer.INSTANCE.deserialize(in));
     }
 
     @Override
     public void serialize(ABinary binary, DataOutput out) throws HyracksDataException {
-        byteArrayPtrSerDer.serialize(binary.getBytes(), binary.getStart(), binary.getLength(), out);
+        ByteArraySerializerDeserializer.INSTANCE.serialize(binary.getBytes(), binary.getStart(), binary.getLength(),
+                out);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9a554a7e/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ACircleSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ACircleSerializerDeserializer.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ACircleSerializerDeserializer.java
index a80047d..4460fd9 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ACircleSerializerDeserializer.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ACircleSerializerDeserializer.java
@@ -23,12 +23,8 @@ import java.io.DataOutput;
 import java.io.IOException;
 
 import org.apache.asterix.dataflow.data.nontagged.Coordinate;
-import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.om.base.ACircle;
-import org.apache.asterix.om.base.AMutableCircle;
-import org.apache.asterix.om.base.AMutablePoint;
 import org.apache.asterix.om.base.APoint;
-import org.apache.asterix.om.types.BuiltinType;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 
@@ -38,12 +34,6 @@ public class ACircleSerializerDeserializer implements ISerializerDeserializer<AC
 
     public static final ACircleSerializerDeserializer INSTANCE = new ACircleSerializerDeserializer();
 
-    @SuppressWarnings("unchecked")
-    private final static ISerializerDeserializer<ACircle> circleSerde = AqlSerializerDeserializerProvider.INSTANCE
-            .getSerializerDeserializer(BuiltinType.ACIRCLE);
-    private final static AMutableCircle aCircle = new AMutableCircle(null, 0);
-    private final static AMutablePoint aPoint = new AMutablePoint(0, 0);
-
     private ACircleSerializerDeserializer() {
     }
 
@@ -83,15 +73,4 @@ public class ACircleSerializerDeserializer implements ISerializerDeserializer<AC
     public final static int getRadiusOffset() throws HyracksDataException {
         return 17;
     }
-
-    public static void parse(String circle, DataOutput out) throws HyracksDataException {
-        try {
-            String[] parts = circle.split(" ");
-            aPoint.setValue(Double.parseDouble(parts[0].split(",")[0]), Double.parseDouble(parts[0].split(",")[1]));
-            aCircle.setValue(aPoint, Double.parseDouble(parts[1].substring(0, parts[1].length())));
-            circleSerde.serialize(aCircle, out);
-        } catch (HyracksDataException e) {
-            throw new HyracksDataException(circle + " can not be an instance of circle");
-        }
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9a554a7e/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADateSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADateSerializerDeserializer.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADateSerializerDeserializer.java
index 081a08b..9509b0b 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADateSerializerDeserializer.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADateSerializerDeserializer.java
@@ -22,12 +22,7 @@ import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
 
-import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.om.base.ADate;
-import org.apache.asterix.om.base.AMutableDate;
-import org.apache.asterix.om.base.temporal.ADateParserFactory;
-import org.apache.asterix.om.base.temporal.GregorianCalendarSystem;
-import org.apache.asterix.om.types.BuiltinType;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 
@@ -36,9 +31,6 @@ public class ADateSerializerDeserializer implements ISerializerDeserializer<ADat
     private static final long serialVersionUID = 1L;
 
     public static final ADateSerializerDeserializer INSTANCE = new ADateSerializerDeserializer();
-    @SuppressWarnings("unchecked")
-    private static final ISerializerDeserializer<ADate> dateSerde = AqlSerializerDeserializerProvider.INSTANCE
-            .getSerializerDeserializer(BuiltinType.ADATE);
 
     private ADateSerializerDeserializer() {
     }
@@ -61,25 +53,6 @@ public class ADateSerializerDeserializer implements ISerializerDeserializer<ADat
         }
     }
 
-    public static void parse(String date, DataOutput out) throws HyracksDataException {
-        AMutableDate aDate = new AMutableDate(0);
-
-        long chrononTimeInMs = 0;
-        try {
-            chrononTimeInMs = ADateParserFactory.parseDatePart(date, 0, date.length());
-        } catch (Exception e) {
-            throw new HyracksDataException(e);
-        }
-
-        short temp = 0;
-        if (chrononTimeInMs < 0 && chrononTimeInMs % GregorianCalendarSystem.CHRONON_OF_DAY != 0) {
-            temp = 1;
-        }
-        aDate.setValue((int) (chrononTimeInMs / GregorianCalendarSystem.CHRONON_OF_DAY) - temp);
-
-        dateSerde.serialize(aDate, out);
-    }
-
     public static int getChronon(byte[] byteArray, int offset) {
         return AInt32SerializerDeserializer.getInt(byteArray, offset);
     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9a554a7e/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADateTimeSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADateTimeSerializerDeserializer.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADateTimeSerializerDeserializer.java
index 657b60e..6eb3600 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADateTimeSerializerDeserializer.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADateTimeSerializerDeserializer.java
@@ -22,13 +22,7 @@ import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
 
-import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.om.base.ADateTime;
-import org.apache.asterix.om.base.AMutableDateTime;
-import org.apache.asterix.om.base.temporal.ADateParserFactory;
-import org.apache.asterix.om.base.temporal.ATimeParserFactory;
-import org.apache.asterix.om.types.BuiltinType;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 
@@ -37,11 +31,6 @@ public class ADateTimeSerializerDeserializer implements ISerializerDeserializer<
     private static final long serialVersionUID = 1L;
 
     public static final ADateTimeSerializerDeserializer INSTANCE = new ADateTimeSerializerDeserializer();
-    @SuppressWarnings("unchecked")
-    private static final ISerializerDeserializer<ADateTime> datetimeSerde = AqlSerializerDeserializerProvider.INSTANCE
-            .getSerializerDeserializer(BuiltinType.ADATETIME);
-    private static final AMutableDateTime aDateTime = new AMutableDateTime(0L);
-    private static final String errorMessage = "This can not be an instance of datetime";
 
     private ADateTimeSerializerDeserializer() {
     }
@@ -64,35 +53,6 @@ public class ADateTimeSerializerDeserializer implements ISerializerDeserializer<
         }
     }
 
-    public static void parse(String datetime, DataOutput out) throws HyracksDataException {
-
-        long chrononTimeInMs = 0;
-        try {
-
-            // +1 if it is negative (-)
-            short timeOffset = (short) ((datetime.charAt(0) == '-') ? 1 : 0);
-
-            timeOffset += 8;
-
-            if (datetime.charAt(timeOffset) != 'T') {
-                timeOffset += 2;
-                if (datetime.charAt(timeOffset) != 'T') {
-                    throw new AlgebricksException(errorMessage + ": missing T");
-                }
-            }
-
-            chrononTimeInMs = ADateParserFactory.parseDatePart(datetime, 0, timeOffset);
-
-            chrononTimeInMs += ATimeParserFactory.parseTimePart(datetime, timeOffset + 1, datetime.length()
-                    - timeOffset - 1);
-        } catch (Exception e) {
-            throw new HyracksDataException(e);
-        }
-        aDateTime.setValue(chrononTimeInMs);
-
-        datetimeSerde.serialize(aDateTime, out);
-    }
-
     public static long getChronon(byte[] data, int offset) {
         return AInt64SerializerDeserializer.getLong(data, offset);
     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9a554a7e/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADayTimeDurationSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADayTimeDurationSerializerDeserializer.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADayTimeDurationSerializerDeserializer.java
index 79f3239..c2e7729 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADayTimeDurationSerializerDeserializer.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADayTimeDurationSerializerDeserializer.java
@@ -22,12 +22,7 @@ import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
 
-import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.om.base.ADayTimeDuration;
-import org.apache.asterix.om.base.AMutableDayTimeDuration;
-import org.apache.asterix.om.base.temporal.ADurationParserFactory;
-import org.apache.asterix.om.base.temporal.ADurationParserFactory.ADurationParseOption;
-import org.apache.asterix.om.types.BuiltinType;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 
@@ -37,10 +32,8 @@ public class ADayTimeDurationSerializerDeserializer implements ISerializerDeseri
 
     public static final ADayTimeDurationSerializerDeserializer INSTANCE = new ADayTimeDurationSerializerDeserializer();
 
-    @SuppressWarnings("unchecked")
-    private static final ISerializerDeserializer<ADayTimeDuration> dayTimeDurationSerde = AqlSerializerDeserializerProvider.INSTANCE
-            .getSerializerDeserializer(BuiltinType.ADAYTIMEDURATION);
-    private static final AMutableDayTimeDuration aDayTimeDuration = new AMutableDayTimeDuration(0);
+    private ADayTimeDurationSerializerDeserializer() {
+    }
 
     @Override
     public ADayTimeDuration deserialize(DataInput in) throws HyracksDataException {
@@ -60,16 +53,6 @@ public class ADayTimeDurationSerializerDeserializer implements ISerializerDeseri
         }
     }
 
-    public void parse(String durationString, DataOutput out) throws HyracksDataException {
-        try {
-            ADurationParserFactory.parseDuration(durationString, 0, durationString.length(), aDayTimeDuration,
-                    ADurationParseOption.All);
-            dayTimeDurationSerde.serialize(aDayTimeDuration, out);
-        } catch (Exception e) {
-            throw new HyracksDataException(e);
-        }
-    }
-
     public static long getDayTime(byte[] data, int offset) {
         return AInt64SerializerDeserializer.getLong(data, offset);
     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9a554a7e/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADurationSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADurationSerializerDeserializer.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADurationSerializerDeserializer.java
index 3108ac9..5eb8369 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADurationSerializerDeserializer.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADurationSerializerDeserializer.java
@@ -22,12 +22,7 @@ import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
 
-import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.om.base.ADuration;
-import org.apache.asterix.om.base.AMutableDuration;
-import org.apache.asterix.om.base.temporal.ADurationParserFactory;
-import org.apache.asterix.om.base.temporal.ADurationParserFactory.ADurationParseOption;
-import org.apache.asterix.om.types.BuiltinType;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 
@@ -36,10 +31,6 @@ public class ADurationSerializerDeserializer implements ISerializerDeserializer<
     private static final long serialVersionUID = 1L;
 
     public static final ADurationSerializerDeserializer INSTANCE = new ADurationSerializerDeserializer();
-    @SuppressWarnings("unchecked")
-    private static final ISerializerDeserializer<ADuration> durationSerde = AqlSerializerDeserializerProvider.INSTANCE
-            .getSerializerDeserializer(BuiltinType.ADURATION);
-    private static final AMutableDuration aDuration = new AMutableDuration(0, 0);
 
     private ADurationSerializerDeserializer() {
     }
@@ -63,18 +54,9 @@ public class ADurationSerializerDeserializer implements ISerializerDeserializer<
         }
     }
 
-    public static void parse(String duration, DataOutput out) throws HyracksDataException {
-        try {
-            ADurationParserFactory.parseDuration(duration, 0, duration.length(), aDuration, ADurationParseOption.All);
-            durationSerde.serialize(aDuration, out);
-        } catch (Exception e) {
-            throw new HyracksDataException(e);
-        }
-    }
-
     /**
      * Get the year-month field of the duration as an integer number of days.
-     * 
+     *
      * @param data
      * @param offset
      * @return
@@ -85,7 +67,7 @@ public class ADurationSerializerDeserializer implements ISerializerDeserializer<
 
     /**
      * Get the day-time field of the duration as an long integer number of milliseconds.
-     * 
+     *
      * @param data
      * @param offset
      * @return

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9a554a7e/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AInt16SerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AInt16SerializerDeserializer.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AInt16SerializerDeserializer.java
index a0469d7..a0c2657 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AInt16SerializerDeserializer.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AInt16SerializerDeserializer.java
@@ -32,6 +32,9 @@ public class AInt16SerializerDeserializer implements ISerializerDeserializer<AIn
 
     public static final AInt16SerializerDeserializer INSTANCE = new AInt16SerializerDeserializer();
 
+    private AInt16SerializerDeserializer() {
+    }
+
     @Override
     public AInt16 deserialize(DataInput in) throws HyracksDataException {
         try {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9a554a7e/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AInt8SerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AInt8SerializerDeserializer.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AInt8SerializerDeserializer.java
index 80ba3ab..16c5f46 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AInt8SerializerDeserializer.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AInt8SerializerDeserializer.java
@@ -32,6 +32,9 @@ public class AInt8SerializerDeserializer implements ISerializerDeserializer<AInt
 
     public static final AInt8SerializerDeserializer INSTANCE = new AInt8SerializerDeserializer();
 
+    private AInt8SerializerDeserializer() {
+    }
+
     @Override
     public AInt8 deserialize(DataInput in) throws HyracksDataException {
         try {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9a554a7e/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AIntervalSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AIntervalSerializerDeserializer.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AIntervalSerializerDeserializer.java
index 5300b28..5d08d52 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AIntervalSerializerDeserializer.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AIntervalSerializerDeserializer.java
@@ -22,15 +22,7 @@ import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
 
-import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.om.base.AInterval;
-import org.apache.asterix.om.base.AMutableInterval;
-import org.apache.asterix.om.base.temporal.ADateParserFactory;
-import org.apache.asterix.om.base.temporal.ATimeParserFactory;
-import org.apache.asterix.om.base.temporal.GregorianCalendarSystem;
-import org.apache.asterix.om.types.ATypeTag;
-import org.apache.asterix.om.types.BuiltinType;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 
@@ -39,11 +31,6 @@ public class AIntervalSerializerDeserializer implements ISerializerDeserializer<
     private static final long serialVersionUID = 1L;
 
     public static final AIntervalSerializerDeserializer INSTANCE = new AIntervalSerializerDeserializer();
-    @SuppressWarnings("unchecked")
-    private static final ISerializerDeserializer<AInterval> intervalSerde = AqlSerializerDeserializerProvider.INSTANCE
-            .getSerializerDeserializer(BuiltinType.AINTERVAL);
-    private static final AMutableInterval aInterval = new AMutableInterval(0L, 0L, (byte) 0);
-    private static final String errorMessage = "This can not be an instance of interval";
 
     private AIntervalSerializerDeserializer() {
     }
@@ -89,179 +76,4 @@ public class AIntervalSerializerDeserializer implements ISerializerDeserializer<
         return data[offset + 8 * 2];
     }
 
-    /**
-     * create an interval value from two given datetime instance.
-     * 
-     * @param interval
-     * @param out
-     * @throws HyracksDataException
-     */
-    public static void parseDatetime(String interval, DataOutput out) throws HyracksDataException {
-
-        long chrononTimeInMsStart = 0;
-        long chrononTimeInMsEnd = 0;
-        try {
-
-            // the starting point for parsing (so for the accessor)
-            int startOffset = 0;
-            int endOffset, timeSeperatorOffsetInDatetimeString;
-
-            // Get the index for the comma
-            int commaIndex = interval.indexOf(',');
-            if (commaIndex < 1) {
-                throw new AlgebricksException("comma is missing for a string of interval");
-            }
-
-            endOffset = commaIndex - 1;
-
-            timeSeperatorOffsetInDatetimeString = interval.indexOf('T');
-
-            if (timeSeperatorOffsetInDatetimeString < 0) {
-                throw new AlgebricksException(errorMessage + ": missing T for a datetime value.");
-            }
-
-            chrononTimeInMsStart = parseDatePart(interval, startOffset, timeSeperatorOffsetInDatetimeString - 1);
-
-            chrononTimeInMsStart += parseTimePart(interval, timeSeperatorOffsetInDatetimeString + 1, endOffset);
-
-            // Interval End
-            startOffset = commaIndex + 1;
-            endOffset = interval.length() - 1;
-
-            timeSeperatorOffsetInDatetimeString = interval.indexOf('T', startOffset);
-
-            if (timeSeperatorOffsetInDatetimeString < 0) {
-                throw new AlgebricksException(errorMessage + ": missing T for a datetime value.");
-            }
-
-            chrononTimeInMsEnd = parseDatePart(interval, startOffset, timeSeperatorOffsetInDatetimeString - 1);
-
-            chrononTimeInMsEnd += parseTimePart(interval, timeSeperatorOffsetInDatetimeString + 1, endOffset);
-        } catch (Exception e) {
-            throw new HyracksDataException(e);
-        }
-
-        try {
-            aInterval.setValue(chrononTimeInMsStart, chrononTimeInMsEnd, ATypeTag.DATETIME.serialize());
-        } catch (AlgebricksException e) {
-            throw new HyracksDataException(e);
-        }
-
-        intervalSerde.serialize(aInterval, out);
-    }
-
-    public static void parseTime(String interval, DataOutput out) throws HyracksDataException {
-
-        long chrononTimeInMsStart = 0;
-        long chrononTimeInMsEnd = 0;
-        try {
-
-            int startOffset = 0;
-            int endOffset;
-
-            // Get the index for the comma
-            int commaIndex = interval.indexOf(',');
-            if (commaIndex < 0) {
-                throw new AlgebricksException("comma is missing for a string of interval");
-            }
-
-            endOffset = commaIndex - 1;
-
-            // Interval Start
-            chrononTimeInMsStart = parseTimePart(interval, startOffset, endOffset);
-
-            if (chrononTimeInMsStart < 0) {
-                chrononTimeInMsStart += GregorianCalendarSystem.CHRONON_OF_DAY;
-            }
-
-            // Interval End
-            startOffset = commaIndex + 1;
-            endOffset = interval.length() - 1;
-
-            chrononTimeInMsEnd = parseTimePart(interval, startOffset, endOffset);
-
-            if (chrononTimeInMsEnd < 0) {
-                chrononTimeInMsEnd += GregorianCalendarSystem.CHRONON_OF_DAY;
-            }
-
-        } catch (Exception e) {
-            throw new HyracksDataException(e);
-        }
-
-        try {
-            aInterval.setValue(chrononTimeInMsStart, chrononTimeInMsEnd, ATypeTag.TIME.serialize());
-        } catch (AlgebricksException e) {
-            throw new HyracksDataException(e);
-        }
-        intervalSerde.serialize(aInterval, out);
-    }
-
-    public static void parseDate(String interval, DataOutput out) throws HyracksDataException {
-
-        long chrononTimeInMsStart = 0;
-        long chrononTimeInMsEnd = 0;
-        try {
-
-            // the starting point for parsing (so for the accessor)
-            int startOffset = 0;
-            int endOffset;
-
-            // Get the index for the comma
-            int commaIndex = interval.indexOf(',');
-            if (commaIndex < 1) {
-                throw new AlgebricksException("comma is missing for a string of interval");
-            }
-
-            endOffset = commaIndex - 1;
-
-            chrononTimeInMsStart = parseDatePart(interval, startOffset, endOffset);
-
-            // Interval End
-            startOffset = commaIndex + 1;
-            endOffset = interval.length() - 1;
-
-            chrononTimeInMsEnd = parseDatePart(interval, startOffset, endOffset);
-
-        } catch (Exception e) {
-            throw new HyracksDataException(e);
-        }
-
-        try {
-            aInterval.setValue((chrononTimeInMsStart / GregorianCalendarSystem.CHRONON_OF_DAY),
-                    (chrononTimeInMsEnd / GregorianCalendarSystem.CHRONON_OF_DAY), ATypeTag.DATE.serialize());
-        } catch (AlgebricksException e) {
-            throw new HyracksDataException(e);
-        }
-
-        intervalSerde.serialize(aInterval, out);
-    }
-
-    private static long parseDatePart(String interval, int startOffset, int endOffset) throws AlgebricksException,
-            HyracksDataException {
-
-        while (interval.charAt(endOffset) == '"' || interval.charAt(endOffset) == ' ') {
-            endOffset--;
-        }
-
-        while (interval.charAt(startOffset) == '"' || interval.charAt(startOffset) == ' ') {
-            startOffset++;
-        }
-
-        return ADateParserFactory.parseDatePart(interval, startOffset, endOffset - startOffset + 1);
-    }
-
-    private static int parseTimePart(String interval, int startOffset, int endOffset) throws AlgebricksException,
-            HyracksDataException {
-
-        while (interval.charAt(endOffset) == '"' || interval.charAt(endOffset) == ' ') {
-            endOffset--;
-        }
-
-        while (interval.charAt(startOffset) == '"' || interval.charAt(startOffset) == ' ') {
-            startOffset++;
-        }
-
-        return ATimeParserFactory.parseTimePart(interval, startOffset, endOffset - startOffset + 1);
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9a554a7e/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ALineSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ALineSerializerDeserializer.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ALineSerializerDeserializer.java
index 67408cd..aef8de0 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ALineSerializerDeserializer.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ALineSerializerDeserializer.java
@@ -23,12 +23,8 @@ import java.io.DataOutput;
 import java.io.IOException;
 
 import org.apache.asterix.dataflow.data.nontagged.Coordinate;
-import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.om.base.ALine;
-import org.apache.asterix.om.base.AMutableLine;
-import org.apache.asterix.om.base.AMutablePoint;
 import org.apache.asterix.om.base.APoint;
-import org.apache.asterix.om.types.BuiltinType;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 
@@ -38,12 +34,8 @@ public class ALineSerializerDeserializer implements ISerializerDeserializer<ALin
 
     public static final ALineSerializerDeserializer INSTANCE = new ALineSerializerDeserializer();
 
-    @SuppressWarnings("unchecked")
-    private final static ISerializerDeserializer<ALine> lineSerde = AqlSerializerDeserializerProvider.INSTANCE
-            .getSerializerDeserializer(BuiltinType.ALINE);
-    private final static AMutableLine aLine = new AMutableLine(null, null);
-    private final static AMutablePoint aLinePoint1 = new AMutablePoint(0, 0);
-    private final static AMutablePoint aLinePoint2 = new AMutablePoint(0, 0);
+    private ALineSerializerDeserializer() {
+    }
 
     @Override
     public ALine deserialize(DataInput in) throws HyracksDataException {
@@ -92,19 +84,4 @@ public class ALineSerializerDeserializer implements ISerializerDeserializer<ALin
         }
     }
 
-    public static void parse(String line, DataOutput out) throws HyracksDataException {
-        try {
-            String[] points = line.split(" ");
-            if (points.length != 2)
-                throw new HyracksDataException("line consists of only 2 points.");
-            aLinePoint1.setValue(Double.parseDouble(points[0].split(",")[0]),
-                    Double.parseDouble(points[0].split(",")[1]));
-            aLinePoint2.setValue(Double.parseDouble(points[1].split(",")[0]),
-                    Double.parseDouble(points[1].split(",")[1]));
-            aLine.setValue(aLinePoint1, aLinePoint2);
-            lineSerde.serialize(aLine, out);
-        } catch (HyracksDataException e) {
-            throw new HyracksDataException(line + " can not be an instance of line");
-        }
-    }
 }


Mime
View raw message