IGNITE-1803: GridQueryProcessor now uses cached field descriptor to access portable object fields.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/93b71c77 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/93b71c77 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/93b71c77 Branch: refs/heads/ignite-1753-1282 Commit: 93b71c777dc287c14df23c366d7c65f2af91cc03 Parents: 37a2a9f Author: vozerov-gridgain <voze...@gridgain.com> Authored: Mon Nov 9 15:05:41 2015 +0300 Committer: vozerov-gridgain <voze...@gridgain.com> Committed: Mon Nov 9 15:05:41 2015 +0300 ---------------------------------------------------------------------- .../processors/query/GridQueryProcessor.java | 31 +++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/93b71c77/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java index d1f9869..c4deaa0 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java @@ -44,6 +44,7 @@ import javax.cache.CacheException; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.IgniteException; import org.apache.ignite.IgniteLogger; +import org.apache.ignite.binary.BinaryField; import org.apache.ignite.cache.CacheTypeMetadata; import org.apache.ignite.cache.QueryEntity; import org.apache.ignite.cache.QueryIndex; @@ -1804,6 +1805,9 @@ public class GridQueryProcessor extends GridProcessorAdapter { /** */ private volatile int isKeyProp; + /** Binary field to speed-up deserialization. */ + private volatile BinaryField field; + /** * Constructor. * @@ -1853,7 +1857,32 @@ public class GridQueryProcessor extends GridProcessorAdapter { obj = isKeyProp0 == 1 ? key : val; } - return ctx.cacheObjects().field(obj, propName); + assert obj instanceof BinaryObject; + + BinaryObject obj0 = (BinaryObject)obj; + + return binaryField(obj0).value(obj0); + } + + /** + * Get binary field for the property. + * + * @param obj Target object. + * @return Binary field. + */ + private BinaryField binaryField(BinaryObject obj) { + BinaryField field0 = field; + + if (field0 == null) + { + field0 = obj.fieldDescriptor(propName); + + assert field0 != null; + + field = field0; + } + + return field0; } /** {@inheritDoc} */