Ignite-950 - Merged query configuration processing.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4b6d1e6f Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4b6d1e6f Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4b6d1e6f Branch: refs/heads/ignite-950-new Commit: 4b6d1e6f59c20246e88227cda10927c877acc019 Parents: d0d0e3e dbe6ce5 Author: Alexey Goncharuk <alexey.goncha...@gmail.com> Authored: Fri Oct 23 14:03:41 2015 +0300 Committer: Alexey Goncharuk <alexey.goncha...@gmail.com> Committed: Fri Oct 23 14:03:41 2015 +0300 ---------------------------------------------------------------------- .../apache/ignite/cache/CacheTypeMetadata.java | 67 +- .../configuration/CacheConfiguration.java | 627 ++++++++++++++++++- .../processors/query/GridQueryIndexing.java | 18 +- .../processors/query/GridQueryProcessor.java | 447 ++++++------- .../ignite/internal/util/IgniteUtils.java | 5 +- .../cache/GridCacheAbstractSelfTest.java | 8 +- .../processors/query/h2/IgniteH2Indexing.java | 21 +- 7 files changed, 862 insertions(+), 331 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/4b6d1e6f/modules/core/src/main/java/org/apache/ignite/cache/CacheTypeMetadata.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/cache/CacheTypeMetadata.java index 95a138d,f2b004e..cddb313 --- a/modules/core/src/main/java/org/apache/ignite/cache/CacheTypeMetadata.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/CacheTypeMetadata.java @@@ -17,19 -17,17 +17,22 @@@ package org.apache.ignite.cache; -import org.apache.ignite.internal.processors.query.*; -import org.apache.ignite.internal.util.tostring.*; -import org.apache.ignite.internal.util.typedef.internal.*; -import org.apache.ignite.lang.*; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.Map; +import org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStore; +import org.apache.ignite.internal.util.tostring.GridToStringInclude; +import org.apache.ignite.internal.util.typedef.internal.S; +import org.apache.ignite.lang.IgniteBiTuple; -import javax.cache.*; + import java.io.*; + import java.util.*; + /** - * Type metadata. + * Cache type metadata need for configuration of indexes or automatic persistence. */ public class CacheTypeMetadata implements Serializable { /** */ @@@ -47,7 -45,10 +50,10 @@@ /** Value class used to store value in cache. */ private String valType; + /** Simple value type name that will be used as SQL table name.*/ + private String simpleValType; + - /** Key fields. */ + /** Optional persistent key fields (needed only if {@link CacheJdbcPojoStore} is used). */ @GridToStringInclude private Collection<CacheTypeFieldMetadata> keyFields; @@@ -275,12 -281,15 +286,15 @@@ } /** - * Sets ascending-indexed fields. + * Sets name-to-type map for ascending-indexed fields. * - * @param ascFlds Map of ascending-indexed fields. + * @param ascFlds Name-to-type map for ascending-indexed fields. */ public void setAscendingFields(Map<String, Class<?>> ascFlds) { - this.ascFlds = ascFlds; + if (ascFlds == null) + this.ascFlds = ascFlds; + else + this.ascFlds.putAll(ascFlds); } /** http://git-wip-us.apache.org/repos/asf/ignite/blob/4b6d1e6f/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java index 2eb7b8d,63d7800..8c699e1 --- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java @@@ -17,48 -17,31 +17,65 @@@ package org.apache.ignite.configuration; -import org.apache.ignite.*; -import org.apache.ignite.cache.*; -import org.apache.ignite.cache.affinity.*; -import org.apache.ignite.cache.affinity.rendezvous.*; -import org.apache.ignite.cache.eviction.*; -import org.apache.ignite.cache.query.annotations.*; -import org.apache.ignite.cache.store.*; -import org.apache.ignite.cluster.*; -import org.apache.ignite.internal.processors.query.*; -import org.apache.ignite.internal.util.tostring.*; -import org.apache.ignite.internal.util.typedef.*; -import org.apache.ignite.internal.util.typedef.internal.*; -import org.apache.ignite.lang.*; -import org.apache.ignite.plugin.*; -import org.jetbrains.annotations.*; - -import javax.cache.*; -import javax.cache.configuration.*; -import javax.cache.expiry.*; -import java.lang.reflect.*; -import java.util.*; +import java.io.Serializable; ++import java.lang.reflect.AccessibleObject; ++import java.lang.reflect.Field; ++import java.lang.reflect.Member; ++import java.lang.reflect.Method; ++import java.util.ArrayList; +import java.util.Collection; ++import java.util.Collections; ++import java.util.Comparator; ++import java.util.HashMap; ++import java.util.LinkedHashMap; ++import java.util.Map; ++import java.util.TreeSet; +import javax.cache.Cache; ++import javax.cache.CacheException; +import javax.cache.configuration.CompleteConfiguration; +import javax.cache.configuration.Factory; +import javax.cache.configuration.MutableConfiguration; +import javax.cache.expiry.ExpiryPolicy; +import org.apache.ignite.Ignite; +import org.apache.ignite.IgniteCache; +import org.apache.ignite.cache.CacheAtomicWriteOrderMode; +import org.apache.ignite.cache.CacheAtomicityMode; +import org.apache.ignite.cache.CacheEntryProcessor; +import org.apache.ignite.cache.CacheInterceptor; +import org.apache.ignite.cache.CacheMemoryMode; +import org.apache.ignite.cache.CacheMode; +import org.apache.ignite.cache.CacheRebalanceMode; +import org.apache.ignite.cache.CacheTypeMetadata; +import org.apache.ignite.cache.CacheWriteSynchronizationMode; +import org.apache.ignite.cache.affinity.AffinityFunction; +import org.apache.ignite.cache.affinity.AffinityKeyMapper; +import org.apache.ignite.cache.eviction.EvictionFilter; +import org.apache.ignite.cache.eviction.EvictionPolicy; ++import org.apache.ignite.cache.query.annotations.QueryGroupIndex; ++import org.apache.ignite.cache.query.annotations.QuerySqlField; +import org.apache.ignite.cache.query.annotations.QuerySqlFunction; ++import org.apache.ignite.cache.query.annotations.QueryTextField; +import org.apache.ignite.cache.store.CacheStore; +import org.apache.ignite.cache.store.CacheStoreSessionListener; +import org.apache.ignite.cluster.ClusterNode; ++import org.apache.ignite.internal.processors.query.GridQueryIndexDescriptor; ++import org.apache.ignite.internal.processors.query.GridQueryIndexType; ++import org.apache.ignite.internal.util.tostring.GridToStringExclude; ++import org.apache.ignite.internal.util.tostring.GridToStringInclude; ++import org.apache.ignite.internal.util.typedef.F; ++import org.apache.ignite.internal.util.typedef.T2; +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.apache.ignite.lang.IgniteBiTuple; +import org.apache.ignite.lang.IgnitePredicate; +import org.apache.ignite.plugin.CachePluginConfiguration; +import org.jetbrains.annotations.Nullable; - - import javax.cache.Cache; - import javax.cache.configuration.CompleteConfiguration; - import javax.cache.configuration.Factory; - import javax.cache.configuration.MutableConfiguration; - import javax.cache.expiry.ExpiryPolicy; - import java.io.Serializable; - import java.util.Collection; +import java.util.HashSet; + import static org.apache.ignite.internal.processors.query.GridQueryIndexType.*; + import static org.apache.ignite.internal.processors.query.GridQueryProcessor.*; + /** * This class defines grid cache configuration. This configuration is passed to * grid via {@link IgniteConfiguration#getCacheConfiguration()} method. It defines all configuration @@@ -1850,19 -1803,242 +1888,256 @@@ public class CacheConfiguration<K, V> e } /** + * Creates a copy of current configuration and removes all cache entry listeners. + * They are executed only locally and should never be sent to remote nodes. + * + * @return Configuration object that will be serialized. + */ + protected Object writeReplace() { + CacheConfiguration<K, V> cfg = new CacheConfiguration<>(this); + + cfg.listenerConfigurations = new HashSet<>(); + + return cfg; + } + ++ /** + * @param desc Type descriptor. + * @return Type metadata. + */ + private static CacheTypeMetadata convert(TypeDescriptor desc) { + CacheTypeMetadata meta = new CacheTypeMetadata(); + + // Key and val types. + meta.setKeyType(desc.keyClass()); + meta.setValueType(desc.valueClass()); + + // Query fields. + Map<String, Class<?>> qryFields = new HashMap<>(); + + for (ClassProperty prop : desc.props.values()) + qryFields.put(prop.fullName(), mask(prop.type())); + + meta.setQueryFields(qryFields); + + // Indexes. + Collection<String> txtFields = new ArrayList<>(); + Map<String, LinkedHashMap<String, IgniteBiTuple<Class<?>, Boolean>>> grps = new HashMap<>(); + + for (Map.Entry<String,GridQueryIndexDescriptor> idxEntry : desc.indexes().entrySet()) { + GridQueryIndexDescriptor idx = idxEntry.getValue(); + + if (idx.type() == FULLTEXT) { + assert txtFields.isEmpty(); + + txtFields.addAll(idx.fields()); + } + else { + LinkedHashMap<String, IgniteBiTuple<Class<?>, Boolean>> grp = new LinkedHashMap<>(); + + for (String fieldName : idx.fields()) { + Class<?> cls; + + if (_VAL.equals(fieldName)) + cls = desc.valueClass(); + else { + ClassProperty prop = desc.props.get(fieldName); + + assert prop != null : fieldName; + + cls = prop.type(); + } + + cls = mask(cls); + + grp.put(fieldName, new IgniteBiTuple<Class<?>, Boolean>(cls, idx.descending(fieldName))); + } + + grps.put(idxEntry.getKey(), grp); + } + } + + meta.setGroups(grps); + + if (desc.valueTextIndex()) + txtFields.add(_VAL); + + if (!txtFields.isEmpty()) + meta.setTextFields(txtFields); + + // Aliases. + Map<String,String> aliases = null; + + for (ClassProperty prop : desc.props.values()) { + while (prop != null) { + if (!F.isEmpty(prop.alias)) { + if (aliases == null) + aliases = new HashMap<>(); + + aliases.put(prop.fullName(), prop.alias); + } + + prop = prop.parent; + } + } + + meta.setAliases(aliases); + + return meta; + } + + /** + * @param cls Class. + * @return Masked class. + */ + private static Class<?> mask(Class<?> cls) { + assert cls != null; + + return isSqlType(cls) ? cls : Object.class; + } + + /** + * @param keyCls Key class. + * @param valCls Value class. + * @return Type descriptor. + */ + private static TypeDescriptor processKeyAndValueClasses( + Class<?> keyCls, + Class<?> valCls + ) { + TypeDescriptor d = new TypeDescriptor(); + + d.keyClass(keyCls); + d.valueClass(valCls); + + processAnnotationsInClass(true, d.keyCls, d, null); + processAnnotationsInClass(false, d.valCls, d, null); + + return d; + } + + /** + * Process annotations for class. + * + * @param key If given class relates to key. + * @param cls Class. + * @param type Type descriptor. + * @param parent Parent in case of embeddable. + */ + private static void processAnnotationsInClass(boolean key, Class<?> cls, TypeDescriptor type, + @Nullable ClassProperty parent) { + if (U.isJdk(cls) || isGeometryClass(cls)) { + if (parent == null && !key && isSqlType(cls)) { // We have to index primitive _val. + String idxName = _VAL + "_idx"; + + type.addIndex(idxName, isGeometryClass(cls) ? GEO_SPATIAL : SORTED); + + type.addFieldToIndex(idxName, _VAL, 0, false); + } + + return; + } + + if (parent != null && parent.knowsClass(cls)) + throw new CacheException("Recursive reference found in type: " + cls.getName()); + + if (parent == null) { // Check class annotation at top level only. + QueryTextField txtAnnCls = cls.getAnnotation(QueryTextField.class); + + if (txtAnnCls != null) + type.valueTextIndex(true); + + QueryGroupIndex grpIdx = cls.getAnnotation(QueryGroupIndex.class); + + if (grpIdx != null) + type.addIndex(grpIdx.name(), SORTED); + + QueryGroupIndex.List grpIdxList = cls.getAnnotation(QueryGroupIndex.List.class); + + if (grpIdxList != null && !F.isEmpty(grpIdxList.value())) { + for (QueryGroupIndex idx : grpIdxList.value()) + type.addIndex(idx.name(), SORTED); + } + } + + for (Class<?> c = cls; c != null && !c.equals(Object.class); c = c.getSuperclass()) { + for (Field field : c.getDeclaredFields()) { + QuerySqlField sqlAnn = field.getAnnotation(QuerySqlField.class); + QueryTextField txtAnn = field.getAnnotation(QueryTextField.class); + + if (sqlAnn != null || txtAnn != null) { + ClassProperty prop = new ClassProperty(field); + + prop.parent(parent); + + processAnnotation(key, sqlAnn, txtAnn, field.getType(), prop, type); + + type.addProperty(prop, true); + } + } + + for (Method mtd : c.getDeclaredMethods()) { + QuerySqlField sqlAnn = mtd.getAnnotation(QuerySqlField.class); + QueryTextField txtAnn = mtd.getAnnotation(QueryTextField.class); + + if (sqlAnn != null || txtAnn != null) { + if (mtd.getParameterTypes().length != 0) + throw new CacheException("Getter with QuerySqlField " + + "annotation cannot have parameters: " + mtd); + + ClassProperty prop = new ClassProperty(mtd); + + prop.parent(parent); + + processAnnotation(key, sqlAnn, txtAnn, mtd.getReturnType(), prop, type); + + type.addProperty(prop, true); + } + } + } + } + + /** + * Processes annotation at field or method. + * + * @param key If given class relates to key. + * @param sqlAnn SQL annotation, can be {@code null}. + * @param txtAnn H2 text annotation, can be {@code null}. + * @param cls Class of field or return type for method. + * @param prop Current property. + * @param desc Class description. + */ + private static void processAnnotation(boolean key, QuerySqlField sqlAnn, QueryTextField txtAnn, + Class<?> cls, ClassProperty prop, TypeDescriptor desc) { + if (sqlAnn != null) { + processAnnotationsInClass(key, cls, desc, prop); + + if (!sqlAnn.name().isEmpty()) + prop.alias(sqlAnn.name()); + + if (sqlAnn.index()) { + String idxName = prop.alias() + "_idx"; + + desc.addIndex(idxName, isGeometryClass(prop.type()) ? GEO_SPATIAL : SORTED); + + desc.addFieldToIndex(idxName, prop.fullName(), 0, sqlAnn.descending()); + } + + if (!F.isEmpty(sqlAnn.groups())) { + for (String group : sqlAnn.groups()) + desc.addFieldToIndex(group, prop.fullName(), 0, false); + } + + if (!F.isEmpty(sqlAnn.orderedGroups())) { + for (QuerySqlField.Group idx : sqlAnn.orderedGroups()) + desc.addFieldToIndex(idx.name(), prop.fullName(), idx.order(), idx.descending()); + } + } + + if (txtAnn != null) + desc.addFieldToTextIndex(prop.fullName()); + } + /** {@inheritDoc} */ @Override public String toString() { return S.toString(CacheConfiguration.class, this); @@@ -1882,10 -2058,318 +2157,318 @@@ /** {@inheritDoc} */ @Override public boolean equals(Object obj) { - if (obj == null) - return false; + return obj != null && obj.getClass().equals(this.getClass()); + } + } + + /** + * Descriptor of type. + */ + private static class TypeDescriptor { + /** Value field names and types with preserved order. */ + @GridToStringInclude + private final Map<String, Class<?>> fields = new LinkedHashMap<>(); + + /** */ + @GridToStringExclude + private final Map<String, ClassProperty> props = new HashMap<>(); + + /** */ + @GridToStringInclude + private final Map<String, IndexDescriptor> indexes = new HashMap<>(); + + /** */ + private IndexDescriptor fullTextIdx; + + /** */ + private Class<?> keyCls; + + /** */ + private Class<?> valCls; + + /** */ + private boolean valTextIdx; + + /** + * @return Indexes. + */ + public Map<String, GridQueryIndexDescriptor> indexes() { + return Collections.<String, GridQueryIndexDescriptor>unmodifiableMap(indexes); + } + + /** + * Adds index. + * + * @param idxName Index name. + * @param type Index type. + * @return Index descriptor. + */ + public IndexDescriptor addIndex(String idxName, GridQueryIndexType type) { + IndexDescriptor idx = new IndexDescriptor(type); + + if (indexes.put(idxName, idx) != null) + throw new CacheException("Index with name '" + idxName + "' already exists."); + + return idx; + } + + /** + * Adds field to index. + * + * @param idxName Index name. + * @param field Field name. + * @param orderNum Fields order number in index. + * @param descending Sorting order. + */ + public void addFieldToIndex(String idxName, String field, int orderNum, + boolean descending) { + IndexDescriptor desc = indexes.get(idxName); + + if (desc == null) + desc = addIndex(idxName, SORTED); + + desc.addField(field, orderNum, descending); + } + + /** + * Adds field to text index. + * + * @param field Field name. + */ + public void addFieldToTextIndex(String field) { + if (fullTextIdx == null) { + fullTextIdx = new IndexDescriptor(FULLTEXT); + + indexes.put(null, fullTextIdx); + } + + fullTextIdx.addField(field, 0, false); + } + + /** + * @return Value class. + */ + public Class<?> valueClass() { + return valCls; + } + + /** + * Sets value class. + * + * @param valCls Value class. + */ + void valueClass(Class<?> valCls) { + this.valCls = valCls; + } + + /** + * @return Key class. + */ + public Class<?> keyClass() { + return keyCls; + } + + /** + * Set key class. + * + * @param keyCls Key class. + */ + void keyClass(Class<?> keyCls) { + this.keyCls = keyCls; + } + + /** + * Adds property to the type descriptor. + * + * @param prop Property. + * @param failOnDuplicate Fail on duplicate flag. + */ + public void addProperty(ClassProperty prop, boolean failOnDuplicate) { + String name = prop.fullName(); + + if (props.put(name, prop) != null && failOnDuplicate) + throw new CacheException("Property with name '" + name + "' already exists."); + + fields.put(name, prop.type()); + } + + /** + * @return {@code true} If we need to have a fulltext index on value. + */ + public boolean valueTextIndex() { + return valTextIdx; + } + + /** + * Sets if this value should be text indexed. + * + * @param valTextIdx Flag value. + */ + public void valueTextIndex(boolean valTextIdx) { + this.valTextIdx = valTextIdx; + } + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(TypeDescriptor.class, this); + } + } + + /** + * Index descriptor. + */ + private static class IndexDescriptor implements GridQueryIndexDescriptor { + /** Fields sorted by order number. */ + private final Collection<T2<String, Integer>> fields = new TreeSet<>( + new Comparator<T2<String, Integer>>() { + @Override public int compare(T2<String, Integer> o1, T2<String, Integer> o2) { + if (o1.get2().equals(o2.get2())) // Order is equal, compare field names to avoid replace in Set. + return o1.get1().compareTo(o2.get1()); + + return o1.get2() < o2.get2() ? -1 : 1; + } + }); + + /** Fields which should be indexed in descending order. */ + private Collection<String> descendings; + + /** */ + private final GridQueryIndexType type; + + /** + * @param type Type. + */ + private IndexDescriptor(GridQueryIndexType type) { + assert type != null; + + this.type = type; + } + + /** {@inheritDoc} */ + @Override public Collection<String> fields() { + Collection<String> res = new ArrayList<>(fields.size()); + + for (T2<String, Integer> t : fields) + res.add(t.get1()); + + return res; + } + + /** {@inheritDoc} */ + @Override public boolean descending(String field) { + return descendings != null && descendings.contains(field); + } + + /** + * Adds field to this index. + * + * @param field Field name. + * @param orderNum Field order number in this index. + * @param descending Sort order. + */ + public void addField(String field, int orderNum, boolean descending) { + fields.add(new T2<>(field, orderNum)); + + if (descending) { + if (descendings == null) + descendings = new HashSet<>(); + + descendings.add(field); + } + } + + /** {@inheritDoc} */ + @Override public GridQueryIndexType type() { + return type; + } + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(IndexDescriptor.class, this); + } + } + + /** + * Description of type property. + */ + private static class ClassProperty { + /** */ + private final Member member; + + /** */ + private ClassProperty parent; + + /** */ + private String name; + + /** */ + private String alias; + + /** + * Constructor. + * + * @param member Element. + */ + ClassProperty(Member member) { + this.member = member; + + name = member instanceof Method && member.getName().startsWith("get") && member.getName().length() > 3 ? + member.getName().substring(3) : member.getName(); + + ((AccessibleObject) member).setAccessible(true); + } + + /** + * @param alias Alias. + */ + public void alias(String alias) { + this.alias = alias; + } + + /** + * @return Alias. + */ + String alias() { + return F.isEmpty(alias) ? name : alias; + } + + /** + * @return Type. + */ + public Class<?> type() { + return member instanceof Field ? ((Field)member).getType() : ((Method)member).getReturnType(); + } + + /** + * @param parent Parent property if this is embeddable element. + */ + public void parent(ClassProperty parent) { + this.parent = parent; + } + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(ClassProperty.class, this); + } + + /** + * @param cls Class. + * @return {@code true} If this property or some parent relates to member of the given class. + */ + public boolean knowsClass(Class<?> cls) { + return member.getDeclaringClass() == cls || (parent != null && parent.knowsClass(cls)); + } + + /** + * @return Full name with all parents in dot notation. + */ + public String fullName() { + assert name != null; + + if (parent == null) + return name; - return obj.getClass().equals(this.getClass()); + return parent.fullName() + '.' + name; } } -} +} http://git-wip-us.apache.org/repos/asf/ignite/blob/4b6d1e6f/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java index cf8d4a2,fd5de66..7697a12 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java @@@ -250,11 -230,4 +234,11 @@@ public interface GridQueryIndexing * @return Backup filter. */ public IndexingQueryFilter backupFilter(List<String> caches, AffinityTopologyVersion topVer, int[] parts); + + /** + * Client disconnected callback. + * + * @param reconnectFut Reconnect future. + */ + public void onDisconnected(IgniteFuture<?> reconnectFut); - } + } http://git-wip-us.apache.org/repos/asf/ignite/blob/4b6d1e6f/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java index 84db145,bfc7b74..b80dfae --- 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 @@@ -17,74 -17,38 +17,76 @@@ package org.apache.ignite.internal.processors.query; -import org.apache.ignite.*; -import org.apache.ignite.cache.*; -import org.apache.ignite.cache.query.*; -import org.apache.ignite.configuration.*; -import org.apache.ignite.events.*; -import org.apache.ignite.internal.*; -import org.apache.ignite.internal.processors.*; -import org.apache.ignite.internal.processors.cache.*; -import org.apache.ignite.internal.processors.cache.query.*; -import org.apache.ignite.internal.util.*; -import org.apache.ignite.internal.util.future.*; -import org.apache.ignite.internal.util.lang.*; -import org.apache.ignite.internal.util.tostring.*; -import org.apache.ignite.internal.util.typedef.*; -import org.apache.ignite.internal.util.typedef.internal.*; -import org.apache.ignite.internal.util.worker.*; -import org.apache.ignite.lang.*; -import org.apache.ignite.spi.indexing.*; -import org.jetbrains.annotations.*; -import org.jsr166.*; +import java.lang.reflect.AccessibleObject; +import java.lang.reflect.Field; +import java.lang.reflect.Member; +import java.lang.reflect.Method; ++import java.math.BigDecimal; ++import java.sql.Time; ++import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.TreeSet; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.ExecutorService; +import javax.cache.Cache; +import javax.cache.CacheException; +import org.apache.ignite.IgniteCheckedException; +import org.apache.ignite.IgniteException; +import org.apache.ignite.IgniteLogger; +import org.apache.ignite.cache.CacheTypeMetadata; +import org.apache.ignite.cache.query.QueryCursor; +import org.apache.ignite.cache.query.SqlFieldsQuery; +import org.apache.ignite.cache.query.SqlQuery; +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.configuration.CacheConfiguration; +import org.apache.ignite.events.CacheQueryExecutedEvent; +import org.apache.ignite.internal.GridKernalContext; +import org.apache.ignite.internal.IgniteInternalFuture; +import org.apache.ignite.internal.processors.GridProcessorAdapter; +import org.apache.ignite.internal.processors.cache.CacheEntryImpl; +import org.apache.ignite.internal.processors.cache.CacheObject; +import org.apache.ignite.internal.processors.cache.CacheObjectContext; +import org.apache.ignite.internal.processors.cache.GridCacheContext; +import org.apache.ignite.internal.processors.cache.QueryCursorImpl; +import org.apache.ignite.internal.processors.cache.query.CacheQueryFuture; +import org.apache.ignite.internal.processors.cache.query.CacheQueryType; +import org.apache.ignite.internal.processors.cache.query.GridCacheTwoStepQuery; +import org.apache.ignite.internal.util.GridSpinBusyLock; +import org.apache.ignite.internal.util.future.GridCompoundFuture; +import org.apache.ignite.internal.util.future.GridFinishedFuture; +import org.apache.ignite.internal.util.lang.GridCloseableIterator; +import org.apache.ignite.internal.util.lang.GridClosureException; +import org.apache.ignite.internal.util.lang.IgniteOutClosureX; +import org.apache.ignite.internal.util.tostring.GridToStringExclude; +import org.apache.ignite.internal.util.tostring.GridToStringInclude; +import org.apache.ignite.internal.util.typedef.F; +import org.apache.ignite.internal.util.typedef.T2; +import org.apache.ignite.internal.util.typedef.internal.S; +import org.apache.ignite.internal.util.typedef.internal.U; +import org.apache.ignite.internal.util.worker.GridWorker; +import org.apache.ignite.internal.util.worker.GridWorkerFuture; +import org.apache.ignite.lang.IgniteBiTuple; +import org.apache.ignite.lang.IgniteFuture; +import org.apache.ignite.spi.indexing.IndexingQueryFilter; +import org.jetbrains.annotations.Nullable; +import org.jsr166.ConcurrentHashMap8; - import static org.apache.ignite.events.EventType.EVT_CACHE_QUERY_EXECUTED; - import static org.apache.ignite.internal.IgniteComponentType.INDEXING; - import static org.apache.ignite.internal.processors.query.GridQueryIndexType.FULLTEXT; - import static org.apache.ignite.internal.processors.query.GridQueryIndexType.GEO_SPATIAL; - import static org.apache.ignite.internal.processors.query.GridQueryIndexType.SORTED; + import javax.cache.*; + import java.lang.reflect.*; -import java.math.*; -import java.sql.*; + import java.util.*; + import java.util.concurrent.*; -import static org.apache.ignite.events.EventType.*; -import static org.apache.ignite.internal.IgniteComponentType.*; -import static org.apache.ignite.internal.processors.query.GridQueryIndexType.*; - /** * Indexing processor. */ @@@ -2126,4 -2011,11 +2064,11 @@@ public class GridQueryProcessor extend return S.toString(TypeName.class, this); } } + + /** + * The way to index. + */ + private enum IndexType { + ASC, DESC, TEXT + } -} +} http://git-wip-us.apache.org/repos/asf/ignite/blob/4b6d1e6f/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/4b6d1e6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/4b6d1e6f/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java ---------------------------------------------------------------------- diff --cc modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java index 8595187,dfa1e5d..6cb4380 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java @@@ -2312,10 -2191,5 +2293,10 @@@ public class IgniteH2Indexing implement return new GridH2KeyValueRowOffheap(this, ptr); } + + /** {@inheritDoc} */ + @Override public boolean preferSwapValue() { + return preferSwapVal; + } } - } + }