[10/29] ignite git commit: IGNITE-5211: Added new constructor: QueryEntity(Class keyCls, Class valCls). This closes #2371. This closes #2388. This closes #2407.
IGNITE-5211: Added new constructor: QueryEntity(Class keyCls, Class valCls). This closes #2371. This closes #2388. This closes #2407. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b093afb8 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b093afb8 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b093afb8 Branch: refs/heads/ignite-5947 Commit: b093afb8231135a4904f5fffd62f5b4c332f1d47 Parents: 4f02504 Author: tledkov-gridgainAuthored: Tue Aug 8 12:05:36 2017 +0300 Committer: devozerov Committed: Tue Aug 8 12:14:07 2017 +0300 -- .../org/apache/ignite/cache/QueryEntity.java| 229 +++ .../configuration/CacheConfiguration.java | 620 +-- .../cache/query/QueryEntityClassProperty.java | 116 .../cache/query/QueryEntityIndexDescriptor.java | 121 .../cache/query/QueryEntityTypeDescriptor.java | 219 +++ .../h2/sql/AbstractH2CompareQueryTest.java | 4 +- 6 files changed, 693 insertions(+), 616 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ignite/blob/b093afb8/modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java b/modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java index 955e7d2..5180100 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java @@ -18,7 +18,9 @@ package org.apache.ignite.cache; import java.io.Serializable; +import java.lang.reflect.Field; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashMap; @@ -27,10 +29,20 @@ import java.util.LinkedHashMap; import java.util.Map; import java.util.Objects; import java.util.Set; +import javax.cache.CacheException; +import org.apache.ignite.cache.query.annotations.QueryGroupIndex; +import org.apache.ignite.cache.query.annotations.QuerySqlField; +import org.apache.ignite.cache.query.annotations.QueryTextField; +import org.apache.ignite.internal.processors.cache.query.QueryEntityClassProperty; +import org.apache.ignite.internal.processors.cache.query.QueryEntityTypeDescriptor; +import org.apache.ignite.internal.processors.query.GridQueryIndexDescriptor; +import org.apache.ignite.internal.processors.query.QueryUtils; import org.apache.ignite.internal.util.tostring.GridToStringInclude; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.internal.A; import org.apache.ignite.internal.util.typedef.internal.S; +import org.apache.ignite.internal.util.typedef.internal.U; +import org.jetbrains.annotations.Nullable; /** * Query entity is a description of {@link org.apache.ignite.IgniteCache cache} entry (composed of key and value) @@ -111,6 +123,16 @@ public class QueryEntity implements Serializable { } /** + * Creates a query entity with the given key and value types. + * + * @param keyCls Key type. + * @param valCls Value type. + */ +public QueryEntity(Class keyCls, Class valCls) { +this(convert(processKeyAndValueClasses(keyCls,valCls))); +} + +/** * Gets key type for this query pair. * * @return Key type. @@ -351,6 +373,213 @@ public class QueryEntity implements Serializable { return this; } +/** + * @param desc Type descriptor. + * @return Type metadata. + */ +private static QueryEntity convert(QueryEntityTypeDescriptor desc) { +QueryEntity entity = new QueryEntity(); + +// Key and val types. +entity.setKeyType(desc.keyClass().getName()); +entity.setValueType(desc.valueClass().getName()); + +for (QueryEntityClassProperty prop : desc.properties().values()) +entity.addQueryField(prop.fullName(), U.box(prop.type()).getName(), prop.alias()); + +entity.setKeyFields(desc.keyProperties()); + +QueryIndex txtIdx = null; + +Collection idxs = new ArrayList<>(); + +for (Map.Entry idxEntry : desc.indexes().entrySet()) { +GridQueryIndexDescriptor idx = idxEntry.getValue(); + +if (idx.type() == QueryIndexType.FULLTEXT) { +assert txtIdx == null; + +txtIdx = new QueryIndex(); + +txtIdx.setIndexType(QueryIndexType.FULLTEXT); + +txtIdx.setFieldNames(idx.fields(), true); +txtIdx.setName(idxEntry.getKey()); +} +else { +QueryIndex sortedIdx = new QueryIndex(); + +
[15/30] ignite git commit: IGNITE-5211: Added new constructor: QueryEntity(Class keyCls, Class valCls). This closes #2371. This closes #2388. This closes #2407.
IGNITE-5211: Added new constructor: QueryEntity(Class keyCls, Class valCls). This closes #2371. This closes #2388. This closes #2407. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9da69389 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9da69389 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9da69389 Branch: refs/heads/ignite-5872 Commit: 9da69389ed307357391e4eb87ae077751f30a58e Parents: 488a6d2 Author: tledkov-gridgainAuthored: Tue Aug 8 12:05:36 2017 +0300 Committer: devozerov Committed: Tue Aug 8 12:05:36 2017 +0300 -- .../org/apache/ignite/cache/QueryEntity.java| 229 +++ .../configuration/CacheConfiguration.java | 615 +-- .../cache/query/QueryEntityClassProperty.java | 116 .../cache/query/QueryEntityIndexDescriptor.java | 121 .../cache/query/QueryEntityTypeDescriptor.java | 219 +++ .../h2/sql/AbstractH2CompareQueryTest.java | 4 +- 6 files changed, 693 insertions(+), 611 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ignite/blob/9da69389/modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java b/modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java index 955e7d2..5180100 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java @@ -18,7 +18,9 @@ package org.apache.ignite.cache; import java.io.Serializable; +import java.lang.reflect.Field; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashMap; @@ -27,10 +29,20 @@ import java.util.LinkedHashMap; import java.util.Map; import java.util.Objects; import java.util.Set; +import javax.cache.CacheException; +import org.apache.ignite.cache.query.annotations.QueryGroupIndex; +import org.apache.ignite.cache.query.annotations.QuerySqlField; +import org.apache.ignite.cache.query.annotations.QueryTextField; +import org.apache.ignite.internal.processors.cache.query.QueryEntityClassProperty; +import org.apache.ignite.internal.processors.cache.query.QueryEntityTypeDescriptor; +import org.apache.ignite.internal.processors.query.GridQueryIndexDescriptor; +import org.apache.ignite.internal.processors.query.QueryUtils; import org.apache.ignite.internal.util.tostring.GridToStringInclude; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.internal.A; import org.apache.ignite.internal.util.typedef.internal.S; +import org.apache.ignite.internal.util.typedef.internal.U; +import org.jetbrains.annotations.Nullable; /** * Query entity is a description of {@link org.apache.ignite.IgniteCache cache} entry (composed of key and value) @@ -111,6 +123,16 @@ public class QueryEntity implements Serializable { } /** + * Creates a query entity with the given key and value types. + * + * @param keyCls Key type. + * @param valCls Value type. + */ +public QueryEntity(Class keyCls, Class valCls) { +this(convert(processKeyAndValueClasses(keyCls,valCls))); +} + +/** * Gets key type for this query pair. * * @return Key type. @@ -351,6 +373,213 @@ public class QueryEntity implements Serializable { return this; } +/** + * @param desc Type descriptor. + * @return Type metadata. + */ +private static QueryEntity convert(QueryEntityTypeDescriptor desc) { +QueryEntity entity = new QueryEntity(); + +// Key and val types. +entity.setKeyType(desc.keyClass().getName()); +entity.setValueType(desc.valueClass().getName()); + +for (QueryEntityClassProperty prop : desc.properties().values()) +entity.addQueryField(prop.fullName(), U.box(prop.type()).getName(), prop.alias()); + +entity.setKeyFields(desc.keyProperties()); + +QueryIndex txtIdx = null; + +Collection idxs = new ArrayList<>(); + +for (Map.Entry idxEntry : desc.indexes().entrySet()) { +GridQueryIndexDescriptor idx = idxEntry.getValue(); + +if (idx.type() == QueryIndexType.FULLTEXT) { +assert txtIdx == null; + +txtIdx = new QueryIndex(); + +txtIdx.setIndexType(QueryIndexType.FULLTEXT); + +txtIdx.setFieldNames(idx.fields(), true); +txtIdx.setName(idxEntry.getKey()); +} +else { +QueryIndex sortedIdx = new QueryIndex(); + +
ignite git commit: IGNITE-5211: Added new constructor: QueryEntity(Class keyCls, Class valCls). This closes #2371. This closes #2388. This closes #2407.
Repository: ignite Updated Branches: refs/heads/master 488a6d271 -> 9da69389e IGNITE-5211: Added new constructor: QueryEntity(Class keyCls, Class valCls). This closes #2371. This closes #2388. This closes #2407. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9da69389 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9da69389 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9da69389 Branch: refs/heads/master Commit: 9da69389ed307357391e4eb87ae077751f30a58e Parents: 488a6d2 Author: tledkov-gridgainAuthored: Tue Aug 8 12:05:36 2017 +0300 Committer: devozerov Committed: Tue Aug 8 12:05:36 2017 +0300 -- .../org/apache/ignite/cache/QueryEntity.java| 229 +++ .../configuration/CacheConfiguration.java | 615 +-- .../cache/query/QueryEntityClassProperty.java | 116 .../cache/query/QueryEntityIndexDescriptor.java | 121 .../cache/query/QueryEntityTypeDescriptor.java | 219 +++ .../h2/sql/AbstractH2CompareQueryTest.java | 4 +- 6 files changed, 693 insertions(+), 611 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ignite/blob/9da69389/modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java b/modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java index 955e7d2..5180100 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java @@ -18,7 +18,9 @@ package org.apache.ignite.cache; import java.io.Serializable; +import java.lang.reflect.Field; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashMap; @@ -27,10 +29,20 @@ import java.util.LinkedHashMap; import java.util.Map; import java.util.Objects; import java.util.Set; +import javax.cache.CacheException; +import org.apache.ignite.cache.query.annotations.QueryGroupIndex; +import org.apache.ignite.cache.query.annotations.QuerySqlField; +import org.apache.ignite.cache.query.annotations.QueryTextField; +import org.apache.ignite.internal.processors.cache.query.QueryEntityClassProperty; +import org.apache.ignite.internal.processors.cache.query.QueryEntityTypeDescriptor; +import org.apache.ignite.internal.processors.query.GridQueryIndexDescriptor; +import org.apache.ignite.internal.processors.query.QueryUtils; import org.apache.ignite.internal.util.tostring.GridToStringInclude; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.internal.A; import org.apache.ignite.internal.util.typedef.internal.S; +import org.apache.ignite.internal.util.typedef.internal.U; +import org.jetbrains.annotations.Nullable; /** * Query entity is a description of {@link org.apache.ignite.IgniteCache cache} entry (composed of key and value) @@ -111,6 +123,16 @@ public class QueryEntity implements Serializable { } /** + * Creates a query entity with the given key and value types. + * + * @param keyCls Key type. + * @param valCls Value type. + */ +public QueryEntity(Class keyCls, Class valCls) { +this(convert(processKeyAndValueClasses(keyCls,valCls))); +} + +/** * Gets key type for this query pair. * * @return Key type. @@ -351,6 +373,213 @@ public class QueryEntity implements Serializable { return this; } +/** + * @param desc Type descriptor. + * @return Type metadata. + */ +private static QueryEntity convert(QueryEntityTypeDescriptor desc) { +QueryEntity entity = new QueryEntity(); + +// Key and val types. +entity.setKeyType(desc.keyClass().getName()); +entity.setValueType(desc.valueClass().getName()); + +for (QueryEntityClassProperty prop : desc.properties().values()) +entity.addQueryField(prop.fullName(), U.box(prop.type()).getName(), prop.alias()); + +entity.setKeyFields(desc.keyProperties()); + +QueryIndex txtIdx = null; + +Collection idxs = new ArrayList<>(); + +for (Map.Entry idxEntry : desc.indexes().entrySet()) { +GridQueryIndexDescriptor idx = idxEntry.getValue(); + +if (idx.type() == QueryIndexType.FULLTEXT) { +assert txtIdx == null; + +txtIdx = new QueryIndex(); + +txtIdx.setIndexType(QueryIndexType.FULLTEXT); + +txtIdx.setFieldNames(idx.fields(), true); +txtIdx.setName(idxEntry.getKey()); +} +