Repository: asterixdb
Updated Branches:
  refs/heads/master 4e1301b4d -> 1027474db


[NO ISSUE][FUN] Bug fixes in JObjectAccessors

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

Details:
1. Align the deserialization start of several datatypes.
2. Assign the open fields in JRecord properly in JRecordAccessor.

Change-Id: I131f1bf70f01cd763cfd008abcba704e757c864e
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2799
Sonar-Qube: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Reviewed-by: abdullah alamoudi <bamou...@gmail.com>


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

Branch: refs/heads/master
Commit: 1027474db08ebb57ecb90594d8cb33d2fab8a3d1
Parents: 4e1301b
Author: Xikui Wang <xkk...@gmail.com>
Authored: Tue Jul 31 10:26:46 2018 -0700
Committer: Xikui Wang <xkk...@gmail.com>
Committed: Wed Aug 1 14:11:52 2018 -0700

----------------------------------------------------------------------
 .../external/library/java/JObjectAccessors.java | 30 ++++++++++----------
 1 file changed, 15 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1027474d/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjectAccessors.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjectAccessors.java
 
b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjectAccessors.java
index 0a706d1..2678a8d 100644
--- 
a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjectAccessors.java
+++ 
b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjectAccessors.java
@@ -306,7 +306,7 @@ public class JObjectAccessors {
                 throws HyracksDataException {
             byte[] b = pointable.getByteArray();
             int s = pointable.getStartOffset();
-            Boolean v = ABooleanSerializerDeserializer.getBoolean(b, s);
+            Boolean v = ABooleanSerializerDeserializer.getBoolean(b, s + 1);
             IJObject jObject = objectPool.allocate(BuiltinType.ABOOLEAN);
             ((JBoolean) jObject).setValue(v);
             return jObject;
@@ -320,7 +320,7 @@ public class JObjectAccessors {
                 throws HyracksDataException {
             byte[] b = pointable.getByteArray();
             int s = pointable.getStartOffset();
-            int v = ADateSerializerDeserializer.getChronon(b, s);
+            int v = ADateSerializerDeserializer.getChronon(b, s + 1);
             IJObject jObject = objectPool.allocate(BuiltinType.ADATE);
             ((JDate) jObject).setValue(v);
             return jObject;
@@ -334,7 +334,7 @@ public class JObjectAccessors {
                 throws HyracksDataException {
             byte[] b = pointable.getByteArray();
             int s = pointable.getStartOffset();
-            long v = ADateTimeSerializerDeserializer.getChronon(b, s);
+            long v = ADateTimeSerializerDeserializer.getChronon(b, s + 1);
             IJObject jObject = objectPool.allocate(BuiltinType.ADATETIME);
             ((JDateTime) jObject).setValue(v);
             return jObject;
@@ -350,7 +350,7 @@ public class JObjectAccessors {
             int s = pointable.getStartOffset();
             int l = pointable.getLength();
             ADuration duration = ADurationSerializerDeserializer.INSTANCE
-                    .deserialize(new DataInputStream(new 
ByteArrayInputStream(b, s, l)));
+                    .deserialize(new DataInputStream(new 
ByteArrayInputStream(b, s + 1, l - 1)));
             IJObject jObject = objectPool.allocate(BuiltinType.ADURATION);
             ((JDuration) jObject).setValue(duration.getMonths(), 
duration.getMilliseconds());
             return jObject;
@@ -364,7 +364,7 @@ public class JObjectAccessors {
                 throws HyracksDataException {
             byte[] b = pointable.getByteArray();
             int s = pointable.getStartOffset();
-            int v = ATimeSerializerDeserializer.getChronon(b, s);
+            int v = ATimeSerializerDeserializer.getChronon(b, s + 1);
             IJObject jObject = objectPool.allocate(BuiltinType.ATIME);
             ((JTime) jObject).setValue(v);
             return jObject;
@@ -378,9 +378,9 @@ public class JObjectAccessors {
                 throws HyracksDataException {
             byte[] b = pointable.getByteArray();
             int s = pointable.getStartOffset();
-            long intervalStart = 
AIntervalSerializerDeserializer.getIntervalStart(b, s);
-            long intervalEnd = 
AIntervalSerializerDeserializer.getIntervalEnd(b, s);
-            byte intervalType = 
AIntervalSerializerDeserializer.getIntervalTimeType(b, s);
+            long intervalStart = 
AIntervalSerializerDeserializer.getIntervalStart(b, s + 1);
+            long intervalEnd = 
AIntervalSerializerDeserializer.getIntervalEnd(b, s + 1);
+            byte intervalType = 
AIntervalSerializerDeserializer.getIntervalTimeType(b, s + 1);
             IJObject jObject = objectPool.allocate(BuiltinType.AINTERVAL);
             ((JInterval) jObject).setValue(intervalStart, intervalEnd, 
intervalType);
             return jObject;
@@ -398,7 +398,7 @@ public class JObjectAccessors {
             int s = pointable.getStartOffset();
             int l = pointable.getLength();
             ACircle v = ACircleSerializerDeserializer.INSTANCE
-                    .deserialize(new DataInputStream(new 
ByteArrayInputStream(b, s, l)));
+                    .deserialize(new DataInputStream(new 
ByteArrayInputStream(b, s + 1, l - 1)));
             JPoint jpoint = (JPoint) objectPool.allocate(BuiltinType.APOINT);
             jpoint.setValue(v.getP().getX(), v.getP().getY());
             IJObject jObject = objectPool.allocate(BuiltinType.ACIRCLE);
@@ -416,7 +416,7 @@ public class JObjectAccessors {
             int s = pointable.getStartOffset();
             int l = pointable.getLength();
             APoint v = APointSerializerDeserializer.INSTANCE
-                    .deserialize(new DataInputStream(new 
ByteArrayInputStream(b, s, l)));
+                    .deserialize(new DataInputStream(new 
ByteArrayInputStream(b, s + 1, l - 1)));
             JPoint jObject = (JPoint) objectPool.allocate(BuiltinType.APOINT);
             jObject.setValue(v.getX(), v.getY());
             return jObject;
@@ -432,7 +432,7 @@ public class JObjectAccessors {
             int s = pointable.getStartOffset();
             int l = pointable.getLength();
             APoint3D v = APoint3DSerializerDeserializer.INSTANCE
-                    .deserialize(new DataInputStream(new 
ByteArrayInputStream(b, s, l)));
+                    .deserialize(new DataInputStream(new 
ByteArrayInputStream(b, s + 1, l - 1)));
             JPoint3D jObject = (JPoint3D) 
objectPool.allocate(BuiltinType.APOINT3D);
             jObject.setValue(v.getX(), v.getY(), v.getZ());
             return jObject;
@@ -448,7 +448,7 @@ public class JObjectAccessors {
             int s = pointable.getStartOffset();
             int l = pointable.getLength();
             ALine v = ALineSerializerDeserializer.INSTANCE
-                    .deserialize(new DataInputStream(new 
ByteArrayInputStream(b, s, l)));
+                    .deserialize(new DataInputStream(new 
ByteArrayInputStream(b, s + 1, l - 1)));
             JLine jObject = (JLine) objectPool.allocate(BuiltinType.ALINE);
             jObject.setValue(v.getP1(), v.getP2());
             return jObject;
@@ -464,7 +464,7 @@ public class JObjectAccessors {
             int s = pointable.getStartOffset();
             int l = pointable.getLength();
             APolygon v = APolygonSerializerDeserializer.INSTANCE
-                    .deserialize(new DataInputStream(new 
ByteArrayInputStream(b, s, l)));
+                    .deserialize(new DataInputStream(new 
ByteArrayInputStream(b, s + 1, l - 1)));
             JPolygon jObject = (JPolygon) 
objectPool.allocate(BuiltinType.APOLYGON);
             jObject.setValue(v.getPoints());
             return jObject;
@@ -480,7 +480,7 @@ public class JObjectAccessors {
             int s = pointable.getStartOffset();
             int l = pointable.getLength();
             ARectangle v = ARectangleSerializerDeserializer.INSTANCE
-                    .deserialize(new DataInputStream(new 
ByteArrayInputStream(b, s, l)));
+                    .deserialize(new DataInputStream(new 
ByteArrayInputStream(b, s + 1, l - 1)));
             JRectangle jObject = (JRectangle) 
objectPool.allocate(BuiltinType.ARECTANGLE);
             jObject.setValue(v.getP1(), v.getP2());
             return jObject;
@@ -498,8 +498,8 @@ public class JObjectAccessors {
         public JRecordAccessor(ARecordType recordType, IObjectPool<IJObject, 
IAType> objectPool) {
             this.typeInfo = new TypeInfo(objectPool, null, null);
             this.jObjects = new IJObject[recordType.getFieldNames().length];
-            this.jRecord = new JRecord(recordType, jObjects);
             this.openFields = new LinkedHashMap<>();
+            this.jRecord = new JRecord(recordType, jObjects, openFields);
         }
 
         @Override

Reply via email to