ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [5/6] ignite git commit: IGNITE-1816: All tests pass.
Date Thu, 12 Nov 2015 13:40:41 GMT
IGNITE-1816: All tests pass.


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

Branch: refs/heads/ignite-1816
Commit: 8065338db941cb12a05329627b829c64a114354e
Parents: ac9af65
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Thu Nov 12 16:28:40 2015 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Thu Nov 12 16:28:40 2015 +0300

----------------------------------------------------------------------
 .../portable/builder/BinaryObjectBuilderImpl.java  |  9 +++++----
 .../portable/builder/PortableBuilderReader.java    | 17 ++++++++++++++---
 2 files changed, 19 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/8065338d/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
index 2e42cbb..509725f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
@@ -205,7 +205,7 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
             Set<Integer> remainsFlds = null;
 
             if (reader != null) {
-                PortableSchema schema = reader.schema();
+                PortableSchema schema = reader.schema(start);
 
                 Map<Integer, Object> assignedFldsById;
 
@@ -213,9 +213,9 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
                     assignedFldsById = U.newHashMap(assignedVals.size());
 
                     for (Map.Entry<String, Object> entry : assignedVals.entrySet())
{
-                        int fldId = ctx.fieldId(typeId, entry.getKey());
+                        int fieldId = ctx.fieldId(typeId, entry.getKey());
 
-                        assignedFldsById.put(fldId, entry.getValue());
+                        assignedFldsById.put(fieldId, entry.getValue());
                     }
 
                     remainsFlds = assignedFldsById.keySet();
@@ -240,6 +240,7 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
 
                 int idx = 0;
 
+                // TODO: + fieldIdLen looks incorrect here.
                 while (reader.position() + fieldIdLen < rawPos) {
                     int fieldId = schema.fieldId(idx++);
                     int fieldLen =
@@ -433,7 +434,7 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
             int fieldIdLen = PortableUtils.fieldIdLength(flags);
             int fieldOffsetLen = PortableUtils.fieldOffsetLength(flags);
 
-            PortableSchema schema = reader.schema();
+            PortableSchema schema = reader.schema(start);
 
             Map<Integer, Object> readCache = new HashMap<>();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8065338d/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderReader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderReader.java
b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderReader.java
index 550b8ea..b6a6b54 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderReader.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderReader.java
@@ -64,7 +64,7 @@ public class PortableBuilderReader implements PortablePositionReadable {
         pos = objImpl.start();
 
         // TODO: IGNITE-1272 - Is class loader needed here?
-        reader = new BinaryReaderExImpl(portableContext(), arr, pos, null);
+        reader = new BinaryReaderExImpl(ctx, arr, pos, null);
     }
 
     /**
@@ -82,10 +82,21 @@ public class PortableBuilderReader implements PortablePositionReadable
{
     }
 
     /**
+     * Get schema of the object, starting at the given position.
+     *
+     * @param start Start position.
      * @return Object's schema.
      */
-    public PortableSchema schema() {
-        return reader.getOrCreateSchema();
+    public PortableSchema schema(int start) {
+        // We can use current reader in case start is equal to initially recorded position.
+        BinaryReaderExImpl targetReader;
+
+        if (start == pos)
+            targetReader = reader;
+        else
+            targetReader = new BinaryReaderExImpl(ctx, arr, start, null);
+
+        return targetReader.getOrCreateSchema();
     }
 
     /**


Mime
View raw message