asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ti...@apache.org
Subject [2/2] asterixdb git commit: [ASTERIXDB-1963][HYR][TYPE] More reuse for ADM serde
Date Thu, 29 Jun 2017 17:50:11 GMT
[ASTERIXDB-1963][HYR][TYPE] More reuse for ADM serde

- user model changes: no
- storage format changes: no
- interface changes: no

Change-Id: I890a4e8de9646e9f64811f9c7331170e7f19d73b
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1784
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
BAD: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Murtadha Hubail <hubailmor@gmail.com>


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

Branch: refs/heads/master
Commit: 1c3dc6181bc7aab6ec5c71880b4b35b86073880b
Parents: 604c921
Author: Till Westmann <tillw@apache.org>
Authored: Thu Jun 29 17:18:36 2017 +0200
Committer: Till Westmann <tillw@apache.org>
Committed: Thu Jun 29 10:49:44 2017 -0700

----------------------------------------------------------------------
 .../asterix/common/exceptions/ErrorCode.java    |  4 ++
 .../main/resources/asx_errormsg/en.properties   |  3 ++
 .../serde/ABinarySerializerDeserializer.java    |  6 +--
 .../serde/ABooleanSerializerDeserializer.java   | 17 +++----
 .../serde/ACircleSerializerDeserializer.java    | 21 +++------
 .../serde/ADateSerializerDeserializer.java      | 14 ++----
 .../serde/ADateTimeSerializerDeserializer.java  | 14 ++----
 .../ADayTimeDurationSerializerDeserializer.java | 14 ++----
 .../serde/ADoubleSerializerDeserializer.java    | 15 ++-----
 .../serde/ADurationSerializerDeserializer.java  | 19 +++-----
 .../serde/AFloatSerializerDeserializer.java     | 10 +----
 .../serde/AInt16SerializerDeserializer.java     | 15 ++-----
 .../serde/AInt32SerializerDeserializer.java     |  9 ++--
 .../serde/AInt64SerializerDeserializer.java     | 21 +++------
 .../serde/AInt8SerializerDeserializer.java      |  5 +--
 .../serde/AIntervalSerializerDeserializer.java  |  5 +--
 .../serde/ALineSerializerDeserializer.java      | 24 +++-------
 .../serde/AObjectSerializerDeserializer.java    |  4 +-
 .../AOrderedListSerializerDeserializer.java     |  6 ++-
 .../serde/APoint3DSerializerDeserializer.java   | 34 ++++----------
 .../serde/APointSerializerDeserializer.java     | 34 ++++++--------
 .../serde/APolygonSerializerDeserializer.java   | 47 +++++++++-----------
 .../serde/ARecordSerializerDeserializer.java    |  2 +-
 .../serde/ARectangleSerializerDeserializer.java | 20 ++-------
 .../serde/AStringSerializerDeserializer.java    |  4 +-
 .../serde/ATimeSerializerDeserializer.java      | 17 ++-----
 .../serde/AUUIDSerializerDeserializer.java      |  1 -
 .../AUnorderedListSerializerDeserializer.java   |  7 +--
 ...YearMonthDurationSerializerDeserializer.java | 18 +++-----
 .../serde/SerializerDeserializerUtil.java       |  4 +-
 .../FloatToDoubleTypeConvertComputer.java       |  2 +-
 .../IntegerToDoubleTypeConvertComputer.java     |  2 +-
 .../IntegerToFloatTypeConvertComputer.java      |  2 +-
 .../BooleanSerializerDeserializer.java          | 18 +++++---
 .../ByteArraySerializerDeserializer.java        | 29 ++++++------
 .../DoubleSerializerDeserializer.java           | 18 +++++---
 .../FloatSerializerDeserializer.java            | 18 +++++---
 .../IntArraySerializerDeserializer.java         | 16 +++++--
 .../Integer64SerializerDeserializer.java        | 20 ++++++---
 .../IntegerSerializerDeserializer.java          | 18 +++++---
 .../ShortSerializerDeserializer.java            | 18 +++++---
 .../UTF8StringSerializerDeserializer.java       |  4 +-
 42 files changed, 241 insertions(+), 338 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
index 5b28d3f..d264008 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
@@ -64,6 +64,10 @@ public class ErrorCode {
     public static final int TYPE_CONVERT_OUT_OF_BOUND = 21;
     public static final int FIELD_SHOULD_BE_TYPED = 22;
     public static final int NC_REQUEST_TIMEOUT = 23;
+    public static final int POLYGON_INVALID_COORDINATE = 24;
+    public static final int POLYGON_3_POINTS = 25;
+    public static final int POLYGON_INVALID = 26;
+
 
     public static final int INSTANTIATION_ERROR = 100;
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties b/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties
index 8045531..11334f1 100644
--- a/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties
+++ b/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties
@@ -57,6 +57,9 @@
 21 = Source value %1$s is out of range that %2$s can hold - %2$s.MAX_VALUE: %3$s, %2$s.MIN_VALUE: %4$s
 22 = The accessed field is untyped, but should be typed
 23 = %1$ss passed before getting back the responses from NCs
+24 = Invalid coordinate
+25 = Polygon must have at least 3 points
+26 = %1$s can not be an instance of polygon
 
 100 = Unable to instantiate class %1$s
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ABinarySerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ABinarySerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ABinarySerializerDeserializer.java
index ee180bf..016a632 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ABinarySerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ABinarySerializerDeserializer.java
@@ -37,13 +37,11 @@ public class ABinarySerializerDeserializer implements ISerializerDeserializer<AB
 
     @Override
     public ABinary deserialize(DataInput in) throws HyracksDataException {
-        return new ABinary(ByteArraySerializerDeserializer.INSTANCE.deserialize(in));
+        return new ABinary(ByteArraySerializerDeserializer.read(in));
     }
 
     @Override
     public void serialize(ABinary binary, DataOutput out) throws HyracksDataException {
-        ByteArraySerializerDeserializer.INSTANCE.serialize(binary.getBytes(), binary.getStart(), binary.getLength(),
-                out);
+        ByteArraySerializerDeserializer.serialize(binary.getBytes(), binary.getStart(), binary.getLength(), out);
     }
-
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ABooleanSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ABooleanSerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ABooleanSerializerDeserializer.java
index 7d6a078..91d22d8 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ABooleanSerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ABooleanSerializerDeserializer.java
@@ -20,11 +20,12 @@ package org.apache.asterix.dataflow.data.nontagged.serde;
 
 import java.io.DataInput;
 import java.io.DataOutput;
-import java.io.IOException;
 
 import org.apache.asterix.om.base.ABoolean;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.primitive.BooleanPointable;
+import org.apache.hyracks.dataflow.common.data.marshalling.BooleanSerializerDeserializer;
 
 public class ABooleanSerializerDeserializer implements ISerializerDeserializer<ABoolean> {
 
@@ -36,23 +37,15 @@ public class ABooleanSerializerDeserializer implements ISerializerDeserializer<A
 
     @Override
     public ABoolean deserialize(DataInput in) throws HyracksDataException {
-        try {
-            return (in.readBoolean()) ? ABoolean.TRUE : ABoolean.FALSE;
-        } catch (IOException ioe) {
-            throw new HyracksDataException(ioe);
-        }
+        return BooleanSerializerDeserializer.read(in) ? ABoolean.TRUE : ABoolean.FALSE;
     }
 
     @Override
     public void serialize(ABoolean instance, DataOutput out) throws HyracksDataException {
-        try {
-            out.writeBoolean(instance.getBoolean());
-        } catch (IOException ioe) {
-            throw new HyracksDataException(ioe);
-        }
+        BooleanSerializerDeserializer.write(instance.getBoolean(), out);
     }
 
     public static boolean getBoolean(byte[] bytes, int offset) {
-        return bytes[offset] != 0;
+        return BooleanPointable.getBoolean(bytes, offset);
     }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ACircleSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ACircleSerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ACircleSerializerDeserializer.java
index ad8375c..cf2199b 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ACircleSerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ACircleSerializerDeserializer.java
@@ -20,13 +20,13 @@ package org.apache.asterix.dataflow.data.nontagged.serde;
 
 import java.io.DataInput;
 import java.io.DataOutput;
-import java.io.IOException;
 
 import org.apache.asterix.dataflow.data.nontagged.Coordinate;
 import org.apache.asterix.om.base.ACircle;
 import org.apache.asterix.om.base.APoint;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.dataflow.common.data.marshalling.DoubleSerializerDeserializer;
 
 public class ACircleSerializerDeserializer implements ISerializerDeserializer<ACircle> {
 
@@ -39,24 +39,15 @@ public class ACircleSerializerDeserializer implements ISerializerDeserializer<AC
 
     @Override
     public ACircle deserialize(DataInput in) throws HyracksDataException {
-        try {
-            APoint center = APointSerializerDeserializer.INSTANCE.deserialize(in);
-            double radius = ADoubleSerializerDeserializer.INSTANCE.deserialize(in).getDoubleValue();
-            return new ACircle(center, radius);
-        } catch (IOException e) {
-            throw new HyracksDataException(e);
-        }
+        APoint center = APointSerializerDeserializer.read(in);
+        double radius = DoubleSerializerDeserializer.read(in);
+        return new ACircle(center, radius);
     }
 
     @Override
     public void serialize(ACircle instance, DataOutput out) throws HyracksDataException {
-        try {
-            out.writeDouble(instance.getP().getX());
-            out.writeDouble(instance.getP().getY());
-            out.writeDouble(instance.getRadius());
-        } catch (IOException e) {
-            throw new HyracksDataException(e);
-        }
+        APointSerializerDeserializer.write(instance.getP(), out);
+        DoubleSerializerDeserializer.write(instance.getRadius(), out);
     }
 
     public final static int getCenterPointCoordinateOffset(Coordinate coordinate) throws HyracksDataException {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADateSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADateSerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADateSerializerDeserializer.java
index 9509b0b..a4ed1eb 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADateSerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADateSerializerDeserializer.java
@@ -20,11 +20,11 @@ package org.apache.asterix.dataflow.data.nontagged.serde;
 
 import java.io.DataInput;
 import java.io.DataOutput;
-import java.io.IOException;
 
 import org.apache.asterix.om.base.ADate;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.dataflow.common.data.marshalling.IntegerSerializerDeserializer;
 
 public class ADateSerializerDeserializer implements ISerializerDeserializer<ADate> {
 
@@ -37,20 +37,12 @@ public class ADateSerializerDeserializer implements ISerializerDeserializer<ADat
 
     @Override
     public ADate deserialize(DataInput in) throws HyracksDataException {
-        try {
-            return new ADate(in.readInt());
-        } catch (IOException e) {
-            throw new HyracksDataException(e);
-        }
+        return new ADate(IntegerSerializerDeserializer.read(in));
     }
 
     @Override
     public void serialize(ADate instance, DataOutput out) throws HyracksDataException {
-        try {
-            out.writeInt(instance.getChrononTimeInDays());
-        } catch (IOException e) {
-            throw new HyracksDataException(e);
-        }
+        IntegerSerializerDeserializer.write(instance.getChrononTimeInDays(), out);
     }
 
     public static int getChronon(byte[] byteArray, int offset) {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADateTimeSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADateTimeSerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADateTimeSerializerDeserializer.java
index 6eb3600..4709e8d 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADateTimeSerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADateTimeSerializerDeserializer.java
@@ -20,11 +20,11 @@ package org.apache.asterix.dataflow.data.nontagged.serde;
 
 import java.io.DataInput;
 import java.io.DataOutput;
-import java.io.IOException;
 
 import org.apache.asterix.om.base.ADateTime;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.dataflow.common.data.marshalling.Integer64SerializerDeserializer;
 
 public class ADateTimeSerializerDeserializer implements ISerializerDeserializer<ADateTime> {
 
@@ -37,20 +37,12 @@ public class ADateTimeSerializerDeserializer implements ISerializerDeserializer<
 
     @Override
     public ADateTime deserialize(DataInput in) throws HyracksDataException {
-        try {
-            return new ADateTime(in.readLong());
-        } catch (IOException e) {
-            throw new HyracksDataException(e);
-        }
+        return new ADateTime(Integer64SerializerDeserializer.read(in));
     }
 
     @Override
     public void serialize(ADateTime instance, DataOutput out) throws HyracksDataException {
-        try {
-            out.writeLong(instance.getChrononTime());
-        } catch (IOException e) {
-            throw new HyracksDataException(e);
-        }
+        Integer64SerializerDeserializer.write(instance.getChrononTime(), out);
     }
 
     public static long getChronon(byte[] data, int offset) {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADayTimeDurationSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADayTimeDurationSerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADayTimeDurationSerializerDeserializer.java
index 3e6bacd..65f1f47 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADayTimeDurationSerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADayTimeDurationSerializerDeserializer.java
@@ -20,11 +20,11 @@ package org.apache.asterix.dataflow.data.nontagged.serde;
 
 import java.io.DataInput;
 import java.io.DataOutput;
-import java.io.IOException;
 
 import org.apache.asterix.om.base.ADayTimeDuration;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.dataflow.common.data.marshalling.Integer64SerializerDeserializer;
 
 public class ADayTimeDurationSerializerDeserializer implements ISerializerDeserializer<ADayTimeDuration> {
 
@@ -37,20 +37,12 @@ public class ADayTimeDurationSerializerDeserializer implements ISerializerDeseri
 
     @Override
     public ADayTimeDuration deserialize(DataInput in) throws HyracksDataException {
-        try {
-            return new ADayTimeDuration(in.readLong());
-        } catch (IOException e) {
-            throw new HyracksDataException(e);
-        }
+        return new ADayTimeDuration(Integer64SerializerDeserializer.read(in));
     }
 
     @Override
     public void serialize(ADayTimeDuration instance, DataOutput out) throws HyracksDataException {
-        try {
-            out.writeLong(instance.getMilliseconds());
-        } catch (IOException e) {
-            throw new HyracksDataException(e);
-        }
+        Integer64SerializerDeserializer.write(instance.getMilliseconds(), out);
     }
 
     public static long getDayTime(byte[] data, int offset) {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADoubleSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADoubleSerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADoubleSerializerDeserializer.java
index 08ba9d8..95a4156 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADoubleSerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADoubleSerializerDeserializer.java
@@ -20,11 +20,11 @@ package org.apache.asterix.dataflow.data.nontagged.serde;
 
 import java.io.DataInput;
 import java.io.DataOutput;
-import java.io.IOException;
 
 import org.apache.asterix.om.base.ADouble;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.dataflow.common.data.marshalling.DoubleSerializerDeserializer;
 
 public class ADoubleSerializerDeserializer implements ISerializerDeserializer<ADouble> {
 
@@ -37,20 +37,12 @@ public class ADoubleSerializerDeserializer implements ISerializerDeserializer<AD
 
     @Override
     public ADouble deserialize(DataInput in) throws HyracksDataException {
-        try {
-            return new ADouble(in.readDouble());
-        } catch (IOException e) {
-            throw new HyracksDataException(e);
-        }
+        return new ADouble(DoubleSerializerDeserializer.read(in));
     }
 
     @Override
     public void serialize(ADouble instance, DataOutput out) throws HyracksDataException {
-        try {
-            out.writeDouble(instance.getDoubleValue());
-        } catch (IOException ioe) {
-            throw new HyracksDataException(ioe);
-        }
+        DoubleSerializerDeserializer.write(instance.getDoubleValue(), out);
     }
 
     public static double getDouble(byte[] bytes, int offset) {
@@ -60,5 +52,4 @@ public class ADoubleSerializerDeserializer implements ISerializerDeserializer<AD
     public static long getLongBits(byte[] bytes, int offset) {
         return AInt64SerializerDeserializer.getLong(bytes, offset);
     }
-
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADurationSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADurationSerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADurationSerializerDeserializer.java
index 5eb8369..0f3bea6 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADurationSerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ADurationSerializerDeserializer.java
@@ -20,11 +20,12 @@ package org.apache.asterix.dataflow.data.nontagged.serde;
 
 import java.io.DataInput;
 import java.io.DataOutput;
-import java.io.IOException;
 
 import org.apache.asterix.om.base.ADuration;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.dataflow.common.data.marshalling.Integer64SerializerDeserializer;
+import org.apache.hyracks.dataflow.common.data.marshalling.IntegerSerializerDeserializer;
 
 public class ADurationSerializerDeserializer implements ISerializerDeserializer<ADuration> {
 
@@ -37,21 +38,15 @@ public class ADurationSerializerDeserializer implements ISerializerDeserializer<
 
     @Override
     public ADuration deserialize(DataInput in) throws HyracksDataException {
-        try {
-            return new ADuration(in.readInt(), in.readLong());
-        } catch (IOException e) {
-            throw new HyracksDataException(e);
-        }
+        final int months = IntegerSerializerDeserializer.read(in);
+        final long seconds = Integer64SerializerDeserializer.read(in);
+        return new ADuration(months, seconds);
     }
 
     @Override
     public void serialize(ADuration instance, DataOutput out) throws HyracksDataException {
-        try {
-            out.writeInt(instance.getMonths());
-            out.writeLong(instance.getMilliseconds());
-        } catch (IOException e) {
-            throw new HyracksDataException(e);
-        }
+        IntegerSerializerDeserializer.write(instance.getMonths(), out);
+        Integer64SerializerDeserializer.write(instance.getMilliseconds(), out);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AFloatSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AFloatSerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AFloatSerializerDeserializer.java
index 8a53b9b..95f5e14 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AFloatSerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AFloatSerializerDeserializer.java
@@ -20,7 +20,6 @@ package org.apache.asterix.dataflow.data.nontagged.serde;
 
 import java.io.DataInput;
 import java.io.DataOutput;
-import java.io.IOException;
 
 import org.apache.asterix.om.base.AFloat;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
@@ -39,20 +38,15 @@ public class AFloatSerializerDeserializer implements ISerializerDeserializer<AFl
 
     @Override
     public AFloat deserialize(DataInput in) throws HyracksDataException {
-        return new AFloat(FloatSerializerDeserializer.INSTANCE.deserialize(in));
+        return new AFloat(FloatSerializerDeserializer.read(in));
     }
 
     @Override
     public void serialize(AFloat instance, DataOutput out) throws HyracksDataException {
-        try {
-            out.writeFloat(instance.getFloatValue());
-        } catch (IOException ioe) {
-            throw new HyracksDataException(ioe);
-        }
+        FloatSerializerDeserializer.write(instance.getFloatValue(), out);
     }
 
     public static float getFloat(byte[] bytes, int offset) {
         return FloatPointable.getFloat(bytes, offset);
     }
-
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AInt16SerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AInt16SerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AInt16SerializerDeserializer.java
index a0c2657..b1b3d26 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AInt16SerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AInt16SerializerDeserializer.java
@@ -20,11 +20,11 @@ package org.apache.asterix.dataflow.data.nontagged.serde;
 
 import java.io.DataInput;
 import java.io.DataOutput;
-import java.io.IOException;
 
 import org.apache.asterix.om.base.AInt16;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.dataflow.common.data.marshalling.ShortSerializerDeserializer;
 
 public class AInt16SerializerDeserializer implements ISerializerDeserializer<AInt16> {
 
@@ -37,20 +37,12 @@ public class AInt16SerializerDeserializer implements ISerializerDeserializer<AIn
 
     @Override
     public AInt16 deserialize(DataInput in) throws HyracksDataException {
-        try {
-            return new AInt16(in.readShort());
-        } catch (IOException ioe) {
-            throw new HyracksDataException(ioe);
-        }
+        return new AInt16(ShortSerializerDeserializer.read(in));
     }
 
     @Override
     public void serialize(AInt16 instance, DataOutput out) throws HyracksDataException {
-        try {
-            out.writeShort(instance.getShortValue());
-        } catch (IOException ioe) {
-            throw new HyracksDataException(ioe);
-        }
+        ShortSerializerDeserializer.write(instance.getShortValue(), out);
     }
 
     public static short getShort(byte[] bytes, int offset) {
@@ -60,5 +52,4 @@ public class AInt16SerializerDeserializer implements ISerializerDeserializer<AIn
     public static int getUnsignedShort(byte[] bytes, int offset) {
         return ((bytes[offset] & 0xff) << 8) + ((bytes[offset + 1] & 0xff) << 0);
     }
-
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AInt32SerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AInt32SerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AInt32SerializerDeserializer.java
index efea3af..869c902 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AInt32SerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AInt32SerializerDeserializer.java
@@ -24,6 +24,7 @@ import java.io.DataOutput;
 import org.apache.asterix.om.base.AInt32;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.primitive.IntegerPointable;
 import org.apache.hyracks.dataflow.common.data.marshalling.IntegerSerializerDeserializer;
 
 public class AInt32SerializerDeserializer implements ISerializerDeserializer<AInt32> {
@@ -37,17 +38,15 @@ public class AInt32SerializerDeserializer implements ISerializerDeserializer<AIn
 
     @Override
     public AInt32 deserialize(DataInput in) throws HyracksDataException {
-        Integer i = IntegerSerializerDeserializer.INSTANCE.deserialize(in);
-        return new AInt32(i);
+        return new AInt32(IntegerSerializerDeserializer.read(in));
     }
 
     @Override
     public void serialize(AInt32 instance, DataOutput out) throws HyracksDataException {
-        IntegerSerializerDeserializer.INSTANCE.serialize(instance.getIntegerValue(), out);
+        IntegerSerializerDeserializer.write(instance.getIntegerValue(), out);
     }
 
     public static int getInt(byte[] bytes, int offset) {
-        return ((bytes[offset] & 0xff) << 24) + ((bytes[offset + 1] & 0xff) << 16) + ((bytes[offset + 2] & 0xff) << 8)
-                + ((bytes[offset + 3] & 0xff) << 0);
+        return IntegerPointable.getInteger(bytes, offset);
     }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AInt64SerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AInt64SerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AInt64SerializerDeserializer.java
index 000339f..7bf5145 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AInt64SerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AInt64SerializerDeserializer.java
@@ -20,11 +20,12 @@ package org.apache.asterix.dataflow.data.nontagged.serde;
 
 import java.io.DataInput;
 import java.io.DataOutput;
-import java.io.IOException;
 
 import org.apache.asterix.om.base.AInt64;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.primitive.LongPointable;
+import org.apache.hyracks.dataflow.common.data.marshalling.Integer64SerializerDeserializer;
 
 public class AInt64SerializerDeserializer implements ISerializerDeserializer<AInt64> {
 
@@ -37,28 +38,16 @@ public class AInt64SerializerDeserializer implements ISerializerDeserializer<AIn
 
     @Override
     public AInt64 deserialize(DataInput in) throws HyracksDataException {
-        try {
-            return new AInt64(in.readLong());
-        } catch (IOException ioe) {
-            throw new HyracksDataException(ioe);
-        }
-
+        return new AInt64(Integer64SerializerDeserializer.read(in));
     }
 
     @Override
     public void serialize(AInt64 instance, DataOutput out) throws HyracksDataException {
-        try {
-            out.writeLong(instance.getLongValue());
-        } catch (IOException ioe) {
-            throw new HyracksDataException(ioe);
-        }
+        Integer64SerializerDeserializer.write(instance.getLongValue(), out);
     }
 
     public static long getLong(byte[] bytes, int offset) {
-        return (((long) (bytes[offset] & 0xff)) << 56) + (((long) (bytes[offset + 1] & 0xff)) << 48)
-                + (((long) (bytes[offset + 2] & 0xff)) << 40) + (((long) (bytes[offset + 3] & 0xff)) << 32)
-                + (((long) (bytes[offset + 4] & 0xff)) << 24) + (((long) (bytes[offset + 5] & 0xff)) << 16)
-                + (((long) (bytes[offset + 6] & 0xff)) << 8) + (bytes[offset + 7] & 0xff);
+        return LongPointable.getLong(bytes, offset);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AInt8SerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AInt8SerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AInt8SerializerDeserializer.java
index 16c5f46..f3bf005 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AInt8SerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AInt8SerializerDeserializer.java
@@ -40,7 +40,7 @@ public class AInt8SerializerDeserializer implements ISerializerDeserializer<AInt
         try {
             return new AInt8(in.readByte());
         } catch (IOException ioe) {
-            throw new HyracksDataException(ioe);
+            throw HyracksDataException.create(ioe);
         }
     }
 
@@ -49,12 +49,11 @@ public class AInt8SerializerDeserializer implements ISerializerDeserializer<AInt
         try {
             out.writeByte(instance.getByteValue());
         } catch (IOException ioe) {
-            throw new HyracksDataException(ioe);
+            throw HyracksDataException.create(ioe);
         }
     }
 
     public static byte getByte(byte[] bytes, int offset) {
         return bytes[offset];
     }
-
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AIntervalSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AIntervalSerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AIntervalSerializerDeserializer.java
index d5b6488..6aeeb4f 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AIntervalSerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AIntervalSerializerDeserializer.java
@@ -63,7 +63,7 @@ public class AIntervalSerializerDeserializer implements ISerializerDeserializer<
             }
             return new AInterval(start, end, tag);
         } catch (IOException e) {
-            throw new HyracksDataException(e);
+            throw HyracksDataException.create(e);
         }
 
     }
@@ -80,7 +80,7 @@ public class AIntervalSerializerDeserializer implements ISerializerDeserializer<
                 out.writeInt((int) instance.getIntervalEnd());
             }
         } catch (IOException e) {
-            throw new HyracksDataException(e);
+            throw HyracksDataException.create(e);
         }
     }
 
@@ -141,5 +141,4 @@ public class AIntervalSerializerDeserializer implements ISerializerDeserializer<
     public static int getIntervalLength(byte[] data, int start) {
         return getTypeSize() + getStartSize(data, start) + getEndSize(data, start);
     }
-
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ALineSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ALineSerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ALineSerializerDeserializer.java
index 0ffa0d0..c87475d 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ALineSerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ALineSerializerDeserializer.java
@@ -20,7 +20,6 @@ package org.apache.asterix.dataflow.data.nontagged.serde;
 
 import java.io.DataInput;
 import java.io.DataOutput;
-import java.io.IOException;
 
 import org.apache.asterix.dataflow.data.nontagged.Coordinate;
 import org.apache.asterix.om.base.ALine;
@@ -39,29 +38,18 @@ public class ALineSerializerDeserializer implements ISerializerDeserializer<ALin
 
     @Override
     public ALine deserialize(DataInput in) throws HyracksDataException {
-        try {
-            APoint p1 = APointSerializerDeserializer.INSTANCE.deserialize(in);
-            APoint p2 = APointSerializerDeserializer.INSTANCE.deserialize(in);
-            return new ALine(p1, p2);
-        } catch (IOException e) {
-            throw new HyracksDataException(e);
-        }
+        APoint p1 = APointSerializerDeserializer.read(in);
+        APoint p2 = APointSerializerDeserializer.read(in);
+        return new ALine(p1, p2);
     }
 
     @Override
     public void serialize(ALine instance, DataOutput out) throws HyracksDataException {
-        try {
-            out.writeDouble(instance.getP1().getX());
-            out.writeDouble(instance.getP1().getY());
-            out.writeDouble(instance.getP2().getX());
-            out.writeDouble(instance.getP2().getY());
-        } catch (IOException e) {
-            throw new HyracksDataException(e);
-        }
+        APointSerializerDeserializer.write(instance.getP1(), out);
+        APointSerializerDeserializer.write(instance.getP2(), out);
     }
 
     public final static int getStartPointCoordinateOffset(Coordinate coordinate) throws HyracksDataException {
-
         switch (coordinate) {
             case X:
                 return 1;
@@ -73,7 +61,6 @@ public class ALineSerializerDeserializer implements ISerializerDeserializer<ALin
     }
 
     public final static int getEndPointCoordinateOffset(Coordinate coordinate) throws HyracksDataException {
-
         switch (coordinate) {
             case X:
                 return 17;
@@ -83,5 +70,4 @@ public class ALineSerializerDeserializer implements ISerializerDeserializer<ALin
                 throw new HyracksDataException("Wrong coordinate");
         }
     }
-
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AObjectSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AObjectSerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AObjectSerializerDeserializer.java
index eb02a99..aef4ca1 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AObjectSerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AObjectSerializerDeserializer.java
@@ -132,7 +132,7 @@ public class AObjectSerializerDeserializer implements ISerializerDeserializer<IA
         try {
             out.writeByte(tag.serialize());
         } catch (IOException e) {
-            throw new HyracksDataException(e);
+            throw HyracksDataException.create(e);
         }
         switch (tag) {
             case MISSING:
@@ -214,7 +214,7 @@ public class AObjectSerializerDeserializer implements ISerializerDeserializer<IA
                 ATypeSerializerDeserializer.INSTANCE.serialize((IAType) instance, out);
                 break;
             default:
-                throw new NotImplementedException(
+                throw new HyracksDataException(
                         "No serializer/deserializer implemented for type " + t.getTypeTag() + " .");
         }
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AOrderedListSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AOrderedListSerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AOrderedListSerializerDeserializer.java
index 0a66d56..df720f1 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AOrderedListSerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AOrderedListSerializerDeserializer.java
@@ -20,10 +20,12 @@ package org.apache.asterix.dataflow.data.nontagged.serde;
 
 import java.io.DataInput;
 import java.io.DataOutput;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.asterix.builders.OrderedListBuilder;
+import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
 import org.apache.asterix.om.base.AOrderedList;
 import org.apache.asterix.om.base.IAObject;
@@ -95,8 +97,8 @@ public class AOrderedListSerializerDeserializer implements ISerializerDeserializ
             }
             AOrderedListType type = new AOrderedListType(currentItemType, "orderedlist");
             return new AOrderedList(type, items);
-        } catch (Exception e) {
-            throw new HyracksDataException(e);
+        } catch (AsterixException | IOException e) {
+            throw HyracksDataException.create(e);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/APoint3DSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/APoint3DSerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/APoint3DSerializerDeserializer.java
index 57e54a7..00291cf 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/APoint3DSerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/APoint3DSerializerDeserializer.java
@@ -27,6 +27,7 @@ import org.apache.asterix.om.base.APoint3D;
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.dataflow.common.data.marshalling.DoubleSerializerDeserializer;
 
 public class APoint3DSerializerDeserializer implements ISerializerDeserializer<APoint3D> {
 
@@ -39,35 +40,17 @@ public class APoint3DSerializerDeserializer implements ISerializerDeserializer<A
 
     @Override
     public APoint3D deserialize(DataInput in) throws HyracksDataException {
-        try {
-            return new APoint3D(in.readDouble(), in.readDouble(), in.readDouble());
-        } catch (IOException e) {
-            throw new HyracksDataException(e);
-        }
+        final double x = DoubleSerializerDeserializer.read(in);
+        final double y = DoubleSerializerDeserializer.read(in);
+        final double z = DoubleSerializerDeserializer.read(in);
+        return new APoint3D(x, y, z);
     }
 
     @Override
     public void serialize(APoint3D instance, DataOutput out) throws HyracksDataException {
-        try {
-            out.writeDouble(instance.getX());
-            out.writeDouble(instance.getY());
-            out.writeDouble(instance.getZ());
-        } catch (IOException e) {
-            throw new HyracksDataException(e);
-        }
-    }
-
-    public static void stringToPoint3d(String instance, DataOutput out) throws HyracksDataException {
-        try {
-            int firstCommaIndex = instance.indexOf(',');
-            int secondCommaIndex = instance.indexOf(',', firstCommaIndex + 1);
-            out.writeByte(ATypeTag.POINT3D.serialize());
-            out.writeDouble(Double.parseDouble(instance.substring(0, firstCommaIndex)));
-            out.writeDouble(Double.parseDouble(instance.substring(firstCommaIndex + 1, secondCommaIndex)));
-            out.writeDouble(Double.parseDouble(instance.substring(secondCommaIndex + 1, instance.length())));
-        } catch (IOException e) {
-            throw new HyracksDataException(e);
-        }
+        DoubleSerializerDeserializer.write(instance.getX(), out);
+        DoubleSerializerDeserializer.write(instance.getY(), out);
+        DoubleSerializerDeserializer.write(instance.getZ(), out);
     }
 
     public final static int getCoordinateOffset(Coordinate coordinate) throws HyracksDataException {
@@ -82,5 +65,4 @@ public class APoint3DSerializerDeserializer implements ISerializerDeserializer<A
                 throw new HyracksDataException("Wrong coordinate");
         }
     }
-
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/APointSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/APointSerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/APointSerializerDeserializer.java
index a927f95..3abc585 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/APointSerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/APointSerializerDeserializer.java
@@ -20,12 +20,12 @@ package org.apache.asterix.dataflow.data.nontagged.serde;
 
 import java.io.DataInput;
 import java.io.DataOutput;
-import java.io.IOException;
 
 import org.apache.asterix.dataflow.data.nontagged.Coordinate;
 import org.apache.asterix.om.base.APoint;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.dataflow.common.data.marshalling.DoubleSerializerDeserializer;
 
 public class APointSerializerDeserializer implements ISerializerDeserializer<APoint> {
 
@@ -38,34 +38,28 @@ public class APointSerializerDeserializer implements ISerializerDeserializer<APo
 
     @Override
     public APoint deserialize(DataInput in) throws HyracksDataException {
-        try {
-            return new APoint(in.readDouble(), in.readDouble());
-        } catch (IOException e) {
-            throw new HyracksDataException(e);
-        }
+        return read(in);
     }
 
     @Override
     public void serialize(APoint instance, DataOutput out) throws HyracksDataException {
-        try {
-            out.writeDouble(instance.getX());
-            out.writeDouble(instance.getY());
-        } catch (IOException e) {
-            throw new HyracksDataException(e);
-        }
+        write(instance, out);
+    }
+
+    public static APoint read(DataInput in) throws HyracksDataException {
+        return new APoint(DoubleSerializerDeserializer.read(in), DoubleSerializerDeserializer.read(in));
+    }
+
+    public static void write(APoint instance, DataOutput out) throws HyracksDataException {
+        serialize(instance.getX(), instance.getY(), out);
     }
 
     public static void serialize(double x, double y, DataOutput out) throws HyracksDataException {
-        try {
-            out.writeDouble(x);
-            out.writeDouble(y);
-        } catch (IOException e) {
-            throw new HyracksDataException(e);
-        }
+        DoubleSerializerDeserializer.write(x, out);
+        DoubleSerializerDeserializer.write(y, out);
     }
 
     public final static int getCoordinateOffset(Coordinate coordinate) throws HyracksDataException {
-
         switch (coordinate) {
             case X:
                 return 1;
@@ -74,7 +68,5 @@ public class APointSerializerDeserializer implements ISerializerDeserializer<APo
             default:
                 throw new HyracksDataException("Wrong coordinate");
         }
-
     }
-
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/APolygonSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/APolygonSerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/APolygonSerializerDeserializer.java
index 5c3e310..83810e3 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/APolygonSerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/APolygonSerializerDeserializer.java
@@ -22,12 +22,14 @@ import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
 
+import org.apache.asterix.common.exceptions.ErrorCode;
 import org.apache.asterix.dataflow.data.nontagged.Coordinate;
 import org.apache.asterix.om.base.APoint;
 import org.apache.asterix.om.base.APolygon;
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.dataflow.common.data.marshalling.ShortSerializerDeserializer;
 
 public class APolygonSerializerDeserializer implements ISerializerDeserializer<APolygon> {
 
@@ -40,59 +42,52 @@ public class APolygonSerializerDeserializer implements ISerializerDeserializer<A
 
     @Override
     public APolygon deserialize(DataInput in) throws HyracksDataException {
-        try {
-            short numberOfPoints = in.readShort();
-            APoint[] points = new APoint[numberOfPoints];
-            for (int i = 0; i < numberOfPoints; i++) {
-                points[i] = APointSerializerDeserializer.INSTANCE.deserialize(in);
-            }
-            return new APolygon(points);
-        } catch (IOException e) {
-            throw new HyracksDataException(e);
+        short numberOfPoints = ShortSerializerDeserializer.read(in);
+        APoint[] points = new APoint[numberOfPoints];
+        for (int i = 0; i < numberOfPoints; i++) {
+            points[i] = APointSerializerDeserializer.read(in);
         }
+        return new APolygon(points);
     }
 
     @Override
     public void serialize(APolygon instance, DataOutput out) throws HyracksDataException {
-        try {
-            int n = instance.getNumberOfPoints();
-            out.writeShort(n);
-            for (int i = 0; i < n; i++) {
-                APointSerializerDeserializer.INSTANCE.serialize(instance.getPoints()[i], out);
-            }
-        } catch (IOException e) {
-            throw new HyracksDataException(e);
+        short n = (short) instance.getNumberOfPoints();
+        ShortSerializerDeserializer.write(n, out);
+        for (int i = 0; i < n; i++) {
+            APointSerializerDeserializer.write(instance.getPoints()[i], out);
         }
     }
 
-    public final static int getNumberOfPointsOffset() throws HyracksDataException {
+    public static int getNumberOfPointsOffset() throws HyracksDataException {
         return 1;
     }
 
-    public final static int getCoordinateOffset(int pointId, Coordinate coordinate) throws HyracksDataException {
+    public static int getCoordinateOffset(int pointId, Coordinate coordinate) throws HyracksDataException {
         switch (coordinate) {
             case X:
                 return 3 + (pointId * 16);
             case Y:
                 return 11 + (pointId * 16);
             default:
-                throw new HyracksDataException("Wrong coordinate");
+                throw HyracksDataException.create(ErrorCode.POLYGON_INVALID_COORDINATE);
         }
     }
 
     public static void parse(String polygon, DataOutput out) throws HyracksDataException {
         try {
             String[] points = polygon.split(" ");
-            if (points.length < 3)
-                throw new HyracksDataException("Polygon must have at least 3 points.");
+            if (points.length < 3) {
+                throw HyracksDataException.create(ErrorCode.POLYGON_3_POINTS);
+            }
             out.writeByte(ATypeTag.POLYGON.serialize());
             out.writeShort(points.length);
             for (int i = 0; i < points.length; i++) {
-                APointSerializerDeserializer.serialize(Double.parseDouble(points[i].split(",")[0]),
-                        Double.parseDouble(points[i].split(",")[1]), out);
+                final String[] split = points[i].split(",");
+                APointSerializerDeserializer.serialize(Double.parseDouble(split[0]), Double.parseDouble(split[1]), out);
             }
-        } catch (Exception e) {
-            throw new HyracksDataException(polygon + " can not be an instance of polygon");
+        } catch (IOException e) {
+            throw HyracksDataException.create(ErrorCode.POLYGON_INVALID, e, polygon);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ARecordSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ARecordSerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ARecordSerializerDeserializer.java
index 0f762ec..6aee698 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ARecordSerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ARecordSerializerDeserializer.java
@@ -119,7 +119,7 @@ public class ARecordSerializerDeserializer implements ISerializerDeserializer<AR
                 return new ARecord(this.recordType, schemaFields);
             }
         } catch (IOException e) {
-            throw new HyracksDataException(e);
+            throw HyracksDataException.create(e);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ARectangleSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ARectangleSerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ARectangleSerializerDeserializer.java
index b12b964..cf1e573 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ARectangleSerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ARectangleSerializerDeserializer.java
@@ -39,29 +39,16 @@ public class ARectangleSerializerDeserializer implements ISerializerDeserializer
 
     @Override
     public ARectangle deserialize(DataInput in) throws HyracksDataException {
-        try {
-            APoint p1 = APointSerializerDeserializer.INSTANCE.deserialize(in);
-            APoint p2 = APointSerializerDeserializer.INSTANCE.deserialize(in);
-            return new ARectangle(p1, p2);
-        } catch (IOException e) {
-            throw new HyracksDataException(e);
-        }
+        return new ARectangle(APointSerializerDeserializer.read(in), APointSerializerDeserializer.read(in));
     }
 
     @Override
     public void serialize(ARectangle instance, DataOutput out) throws HyracksDataException {
-        try {
-            out.writeDouble(instance.getP1().getX());
-            out.writeDouble(instance.getP1().getY());
-            out.writeDouble(instance.getP2().getX());
-            out.writeDouble(instance.getP2().getY());
-        } catch (IOException e) {
-            throw new HyracksDataException(e);
-        }
+        APointSerializerDeserializer.write(instance.getP1(), out);
+        APointSerializerDeserializer.write(instance.getP2(), out);
     }
 
     public final static int getBottomLeftCoordinateOffset(Coordinate coordinate) throws HyracksDataException {
-
         switch (coordinate) {
             case X:
                 return 1;
@@ -73,7 +60,6 @@ public class ARectangleSerializerDeserializer implements ISerializerDeserializer
     }
 
     public final static int getUpperRightCoordinateOffset(Coordinate coordinate) throws HyracksDataException {
-
         switch (coordinate) {
             case X:
                 return 17;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AStringSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AStringSerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AStringSerializerDeserializer.java
index be86c48..888b34c 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AStringSerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AStringSerializerDeserializer.java
@@ -57,7 +57,7 @@ public class AStringSerializerDeserializer implements ISerializerDeserializer<AS
         try {
             return new AString(UTF8StringUtil.readUTF8(in, utf8StringReader));
         } catch (IOException e) {
-            throw new HyracksDataException(e);
+            throw HyracksDataException.create(e);
         }
     }
 
@@ -66,7 +66,7 @@ public class AStringSerializerDeserializer implements ISerializerDeserializer<AS
         try {
             UTF8StringUtil.writeUTF8(instance.getStringValue(), out, utf8StringWriter);
         } catch (IOException e) {
-            throw new HyracksDataException(e);
+            throw HyracksDataException.create(e);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ATimeSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ATimeSerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ATimeSerializerDeserializer.java
index 73c12ad..3830e2a 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ATimeSerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ATimeSerializerDeserializer.java
@@ -20,11 +20,11 @@ package org.apache.asterix.dataflow.data.nontagged.serde;
 
 import java.io.DataInput;
 import java.io.DataOutput;
-import java.io.IOException;
 
 import org.apache.asterix.om.base.ATime;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.dataflow.common.data.marshalling.IntegerSerializerDeserializer;
 
 public class ATimeSerializerDeserializer implements ISerializerDeserializer<ATime> {
 
@@ -37,26 +37,15 @@ public class ATimeSerializerDeserializer implements ISerializerDeserializer<ATim
 
     @Override
     public ATime deserialize(DataInput in) throws HyracksDataException {
-        try {
-            return new ATime(in.readInt());
-
-        } catch (IOException e) {
-            throw new HyracksDataException(e);
-        }
+        return new ATime(IntegerSerializerDeserializer.read(in));
     }
 
     @Override
     public void serialize(ATime instance, DataOutput out) throws HyracksDataException {
-        try {
-            out.writeInt(instance.getChrononTime());
-
-        } catch (IOException e) {
-            throw new HyracksDataException(e);
-        }
+        IntegerSerializerDeserializer.write(instance.getChrononTime(), out);
     }
 
     public static int getChronon(byte[] byteArray, int offset) {
         return AInt32SerializerDeserializer.getInt(byteArray, offset);
     }
-
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AUUIDSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AUUIDSerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AUUIDSerializerDeserializer.java
index 9ed398e..a970ea3 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AUUIDSerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AUUIDSerializerDeserializer.java
@@ -44,5 +44,4 @@ public class AUUIDSerializerDeserializer implements ISerializerDeserializer<AUUI
     public void serialize(AUUID instance, DataOutput out) throws HyracksDataException {
         instance.writeTo(out);
     }
-
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AUnorderedListSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AUnorderedListSerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AUnorderedListSerializerDeserializer.java
index a6090af..b9afeb0 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AUnorderedListSerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AUnorderedListSerializerDeserializer.java
@@ -20,9 +20,11 @@ package org.apache.asterix.dataflow.data.nontagged.serde;
 
 import java.io.DataInput;
 import java.io.DataOutput;
+import java.io.IOException;
 import java.util.ArrayList;
 
 import org.apache.asterix.builders.UnorderedListBuilder;
+import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
 import org.apache.asterix.om.base.AUnorderedList;
 import org.apache.asterix.om.base.IACursor;
@@ -96,8 +98,8 @@ public class AUnorderedListSerializerDeserializer implements ISerializerDeserial
             }
             AUnorderedListType type = new AUnorderedListType(currentItemType, "unorderedlist");
             return new AUnorderedList(type, items);
-        } catch (Exception e) {
-            throw new HyracksDataException(e);
+        } catch (AsterixException | IOException e) {
+            throw HyracksDataException.create(e);
         }
     }
 
@@ -144,5 +146,4 @@ public class AUnorderedListSerializerDeserializer implements ISerializerDeserial
             return -1;
         }
     }
-
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AYearMonthDurationSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AYearMonthDurationSerializerDeserializer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AYearMonthDurationSerializerDeserializer.java
index f927204..3f970f1 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AYearMonthDurationSerializerDeserializer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AYearMonthDurationSerializerDeserializer.java
@@ -20,41 +20,33 @@ package org.apache.asterix.dataflow.data.nontagged.serde;
 
 import java.io.DataInput;
 import java.io.DataOutput;
-import java.io.IOException;
 
 import org.apache.asterix.om.base.AYearMonthDuration;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.dataflow.common.data.marshalling.IntegerSerializerDeserializer;
 
 public class AYearMonthDurationSerializerDeserializer implements ISerializerDeserializer<AYearMonthDuration> {
 
     private static final long serialVersionUID = 1L;
 
-    public static final AYearMonthDurationSerializerDeserializer INSTANCE = new AYearMonthDurationSerializerDeserializer();
+    public static final AYearMonthDurationSerializerDeserializer INSTANCE =
+            new AYearMonthDurationSerializerDeserializer();
 
     private AYearMonthDurationSerializerDeserializer() {
     }
 
     @Override
     public AYearMonthDuration deserialize(DataInput in) throws HyracksDataException {
-        try {
-            return new AYearMonthDuration(in.readInt());
-        } catch (IOException e) {
-            throw new HyracksDataException(e);
-        }
+        return new AYearMonthDuration(IntegerSerializerDeserializer.read(in));
     }
 
     @Override
     public void serialize(AYearMonthDuration instance, DataOutput out) throws HyracksDataException {
-        try {
-            out.writeInt(instance.getMonths());
-        } catch (IOException e) {
-            throw new HyracksDataException(e);
-        }
+        IntegerSerializerDeserializer.write(instance.getMonths(), out);
     }
 
     public static int getYearMonth(byte[] data, int offset) {
         return AInt32SerializerDeserializer.getInt(data, offset);
     }
-
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/SerializerDeserializerUtil.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/SerializerDeserializerUtil.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/SerializerDeserializerUtil.java
index 37c5e92..b0844ae 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/SerializerDeserializerUtil.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/SerializerDeserializerUtil.java
@@ -66,7 +66,7 @@ public final class SerializerDeserializerUtil {
         try {
             out.writeByte(tag.serialize());
         } catch (IOException e) {
-            throw new HyracksDataException(e);
+            throw HyracksDataException.create(e);
         }
     }
 
@@ -74,7 +74,7 @@ public final class SerializerDeserializerUtil {
         try {
             return EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(in.readByte());
         } catch (IOException e) {
-            throw new HyracksDataException(e);
+            throw HyracksDataException.create(e);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/FloatToDoubleTypeConvertComputer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/FloatToDoubleTypeConvertComputer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/FloatToDoubleTypeConvertComputer.java
index eaddfff..548768e 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/FloatToDoubleTypeConvertComputer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/FloatToDoubleTypeConvertComputer.java
@@ -44,7 +44,7 @@ public class FloatToDoubleTypeConvertComputer implements ITypeConvertComputer {
     public void convertType(byte[] data, int start, int length, DataOutput out) throws IOException {
         double targetValue = convertType(data, start);
         out.writeByte(ATypeTag.DOUBLE.serialize());
-        DoubleSerializerDeserializer.INSTANCE.serialize(targetValue, out);
+        DoubleSerializerDeserializer.write(targetValue, out);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/IntegerToDoubleTypeConvertComputer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/IntegerToDoubleTypeConvertComputer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/IntegerToDoubleTypeConvertComputer.java
index 37f29ed..55bba87 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/IntegerToDoubleTypeConvertComputer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/IntegerToDoubleTypeConvertComputer.java
@@ -53,7 +53,7 @@ public class IntegerToDoubleTypeConvertComputer implements ITypeConvertComputer
     public void convertType(byte[] data, int start, int length, DataOutput out) throws IOException {
         long val = AbstractIntegerTypeConvertComputer.asLong(data, start, length);
         out.writeByte(ATypeTag.DOUBLE.serialize());
-        DoubleSerializerDeserializer.INSTANCE.serialize((double) val, out);
+        DoubleSerializerDeserializer.write((double) val, out);
     }
 
     double convertType(byte[] data, int start, ATypeTag sourceTypeTag) throws HyracksDataException {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/IntegerToFloatTypeConvertComputer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/IntegerToFloatTypeConvertComputer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/IntegerToFloatTypeConvertComputer.java
index e072dd5..4aa4749 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/IntegerToFloatTypeConvertComputer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/IntegerToFloatTypeConvertComputer.java
@@ -71,7 +71,7 @@ public class IntegerToFloatTypeConvertComputer implements ITypeConvertComputer {
                         new ATypeTag[] { ATypeTag.TINYINT, ATypeTag.SMALLINT, ATypeTag.INTEGER, ATypeTag.BIGINT }));
         }
         out.writeByte(ATypeTag.FLOAT.serialize());
-        FloatSerializerDeserializer.INSTANCE.serialize(val, out);
+        FloatSerializerDeserializer.write(val, out);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/marshalling/BooleanSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/marshalling/BooleanSerializerDeserializer.java b/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/marshalling/BooleanSerializerDeserializer.java
index a69cb01..3f3a0db 100644
--- a/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/marshalling/BooleanSerializerDeserializer.java
+++ b/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/marshalling/BooleanSerializerDeserializer.java
@@ -35,19 +35,27 @@ public class BooleanSerializerDeserializer implements ISerializerDeserializer<Bo
 
     @Override
     public Boolean deserialize(DataInput in) throws HyracksDataException {
+        return read(in);
+    }
+
+    @Override
+    public void serialize(Boolean instance, DataOutput out) throws HyracksDataException {
+        write(instance, out);
+    }
+
+    public static boolean read(DataInput in) throws HyracksDataException {
         try {
             return in.readBoolean();
         } catch (IOException e) {
-            throw new HyracksDataException(e);
+            throw HyracksDataException.create(e);
         }
     }
 
-    @Override
-    public void serialize(Boolean instance, DataOutput out) throws HyracksDataException {
+    public static void write(boolean instance, DataOutput out) throws HyracksDataException {
         try {
-            out.writeBoolean(instance.booleanValue());
+            out.writeBoolean(instance);
         } catch (IOException e) {
-            throw new HyracksDataException(e);
+            throw HyracksDataException.create(e);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/marshalling/ByteArraySerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/marshalling/ByteArraySerializerDeserializer.java b/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/marshalling/ByteArraySerializerDeserializer.java
index 7b4f7b6..ad3ede5 100644
--- a/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/marshalling/ByteArraySerializerDeserializer.java
+++ b/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/marshalling/ByteArraySerializerDeserializer.java
@@ -46,14 +46,7 @@ public class ByteArraySerializerDeserializer implements ISerializerDeserializer<
      */
     @Override
     public byte[] deserialize(DataInput in) throws HyracksDataException {
-        try {
-            int contentLength = VarLenIntEncoderDecoder.decode(in);
-            byte[] bytes = new byte[contentLength];
-            in.readFully(bytes, 0, contentLength);
-            return bytes;
-        } catch (IOException e) {
-            throw new HyracksDataException(e);
-        }
+        return read(in);
     }
 
     /**
@@ -62,16 +55,24 @@ public class ByteArraySerializerDeserializer implements ISerializerDeserializer<
      */
     @Override
     public void serialize(byte[] instance, DataOutput out) throws HyracksDataException {
+        write(instance, out);
+    }
+
+    public static byte[] read(DataInput in) throws HyracksDataException {
         try {
-            byte[] metaBuffer = new byte[5];
-            int metaLength = VarLenIntEncoderDecoder.encode(instance.length, metaBuffer, 0);
-            out.write(metaBuffer, 0, metaLength);
-            out.write(instance);
+            int contentLength = VarLenIntEncoderDecoder.decode(in);
+            byte[] bytes = new byte[contentLength];
+            in.readFully(bytes, 0, contentLength);
+            return bytes;
         } catch (IOException e) {
-            throw new HyracksDataException(e);
+            throw HyracksDataException.create(e);
         }
     }
 
+    public static void write(byte[] instance, DataOutput out) throws HyracksDataException {
+        serialize(instance, 0, instance.length, out);
+    }
+
     public void serialize(ByteArrayPointable byteArrayPtr, DataOutput out) throws HyracksDataException {
         try {
             out.write(byteArrayPtr.getByteArray(), byteArrayPtr.getStartOffset(), byteArrayPtr.getLength());
@@ -81,7 +82,7 @@ public class ByteArraySerializerDeserializer implements ISerializerDeserializer<
     }
 
     // A pure byte array, which doesn't have the length information encoded at the beginning
-    public void serialize(byte[] instance, int start, int length, DataOutput out) throws HyracksDataException {
+    public static void serialize(byte[] instance, int start, int length, DataOutput out) throws HyracksDataException {
         byte[] metaBuffer = new byte[5];
         int metaLength = VarLenIntEncoderDecoder.encode(length, metaBuffer, 0);
         try {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/marshalling/DoubleSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/marshalling/DoubleSerializerDeserializer.java b/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/marshalling/DoubleSerializerDeserializer.java
index c586119..f7e0b40 100644
--- a/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/marshalling/DoubleSerializerDeserializer.java
+++ b/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/marshalling/DoubleSerializerDeserializer.java
@@ -35,19 +35,27 @@ public class DoubleSerializerDeserializer implements ISerializerDeserializer<Dou
 
     @Override
     public Double deserialize(DataInput in) throws HyracksDataException {
+        return read(in);
+    }
+
+    @Override
+    public void serialize(Double instance, DataOutput out) throws HyracksDataException {
+        write(instance, out);
+    }
+
+    public static double read(DataInput in) throws HyracksDataException {
         try {
             return in.readDouble();
         } catch (IOException e) {
-            throw new HyracksDataException(e);
+            throw HyracksDataException.create(e);
         }
     }
 
-    @Override
-    public void serialize(Double instance, DataOutput out) throws HyracksDataException {
+    public static void write(double instance, DataOutput out) throws HyracksDataException {
         try {
-            out.writeDouble(instance.doubleValue());
+            out.writeDouble(instance);
         } catch (IOException e) {
-            throw new HyracksDataException(e);
+            throw HyracksDataException.create(e);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/marshalling/FloatSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/marshalling/FloatSerializerDeserializer.java b/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/marshalling/FloatSerializerDeserializer.java
index 9e6edc0..3b53380 100644
--- a/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/marshalling/FloatSerializerDeserializer.java
+++ b/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/marshalling/FloatSerializerDeserializer.java
@@ -35,19 +35,27 @@ public class FloatSerializerDeserializer implements ISerializerDeserializer<Floa
 
     @Override
     public Float deserialize(DataInput in) throws HyracksDataException {
+        return read(in);
+    }
+
+    @Override
+    public void serialize(Float instance, DataOutput out) throws HyracksDataException {
+        write(instance, out);
+    }
+
+    public static float read(DataInput in) throws HyracksDataException {
         try {
             return in.readFloat();
         } catch (IOException e) {
-            throw new HyracksDataException(e);
+            throw HyracksDataException.create(e);
         }
     }
 
-    @Override
-    public void serialize(Float instance, DataOutput out) throws HyracksDataException {
+    public static void write(float instance, DataOutput out) throws HyracksDataException {
         try {
-            out.writeFloat(instance.floatValue());
+            out.writeFloat(instance);
         } catch (IOException e) {
-            throw new HyracksDataException(e);
+            throw HyracksDataException.create(e);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/marshalling/IntArraySerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/marshalling/IntArraySerializerDeserializer.java b/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/marshalling/IntArraySerializerDeserializer.java
index 3507bca..e884efe 100644
--- a/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/marshalling/IntArraySerializerDeserializer.java
+++ b/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/marshalling/IntArraySerializerDeserializer.java
@@ -35,6 +35,15 @@ public class IntArraySerializerDeserializer implements ISerializerDeserializer<i
 
     @Override
     public int[] deserialize(DataInput in) throws HyracksDataException {
+        return read(in);
+    }
+
+    @Override
+    public void serialize(int[] instance, DataOutput out) throws HyracksDataException {
+        write(instance, out);
+    }
+
+    public static int[] read(DataInput in) throws HyracksDataException {
         try {
             int len = in.readInt();
             int[] array = new int[len];
@@ -43,19 +52,18 @@ public class IntArraySerializerDeserializer implements ISerializerDeserializer<i
             }
             return array;
         } catch (IOException e) {
-            throw new HyracksDataException(e);
+            throw HyracksDataException.create(e);
         }
     }
 
-    @Override
-    public void serialize(int[] instance, DataOutput out) throws HyracksDataException {
+    public static void write(int[] instance, DataOutput out) throws HyracksDataException {
         try {
             out.writeInt(instance.length);
             for (int i = 0; i < instance.length; ++i) {
                 out.writeInt(instance[i]);
             }
         } catch (IOException e) {
-            throw new HyracksDataException(e);
+            throw HyracksDataException.create(e);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/marshalling/Integer64SerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/marshalling/Integer64SerializerDeserializer.java b/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/marshalling/Integer64SerializerDeserializer.java
index da5e99b..9684fdb 100644
--- a/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/marshalling/Integer64SerializerDeserializer.java
+++ b/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/marshalling/Integer64SerializerDeserializer.java
@@ -36,19 +36,27 @@ public class Integer64SerializerDeserializer implements ISerializerDeserializer<
 
     @Override
     public Long deserialize(DataInput in) throws HyracksDataException {
+        return read(in);
+    }
+
+    @Override
+    public void serialize(Long instance, DataOutput out) throws HyracksDataException {
+        write(instance, out);
+    }
+
+    public static long read(DataInput in) throws HyracksDataException {
         try {
             return in.readLong();
         } catch (IOException e) {
-            throw new HyracksDataException(e);
+            throw HyracksDataException.create(e);
         }
     }
 
-    @Override
-    public void serialize(Long instance, DataOutput out) throws HyracksDataException {
+    public static void write(long instance, DataOutput out) throws HyracksDataException {
         try {
-            out.writeLong(instance.longValue());
-        } catch (IOException ioe) {
-            throw new HyracksDataException(ioe);
+            out.writeLong(instance);
+        } catch (IOException e) {
+            throw HyracksDataException.create(e);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1c3dc618/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/marshalling/IntegerSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/marshalling/IntegerSerializerDeserializer.java b/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/marshalling/IntegerSerializerDeserializer.java
index 9faddbe..4ff3c11 100644
--- a/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/marshalling/IntegerSerializerDeserializer.java
+++ b/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/marshalling/IntegerSerializerDeserializer.java
@@ -35,19 +35,27 @@ public class IntegerSerializerDeserializer implements ISerializerDeserializer<In
 
     @Override
     public Integer deserialize(DataInput in) throws HyracksDataException {
+        return read(in);
+    }
+
+    @Override
+    public void serialize(Integer instance, DataOutput out) throws HyracksDataException {
+        write(instance, out);
+    }
+
+    public static int read(DataInput in) throws HyracksDataException {
         try {
             return in.readInt();
         } catch (IOException e) {
-            throw new HyracksDataException(e);
+            throw HyracksDataException.create(e);
         }
     }
 
-    @Override
-    public void serialize(Integer instance, DataOutput out) throws HyracksDataException {
+    public static void write(int instance, DataOutput out) throws HyracksDataException {
         try {
-            out.writeInt(instance.intValue());
+            out.writeInt(instance);
         } catch (IOException e) {
-            throw new HyracksDataException(e);
+            throw HyracksDataException.create(e);
         }
     }
 }


Mime
View raw message