IGNITE-950 - Merge branch 'ignite-959-x into ignite-950
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/2e8f713f Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/2e8f713f Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/2e8f713f Branch: refs/heads/ignite-950 Commit: 2e8f713f094e0f5a2af8102ddc7fcf6102c7dc9c Parents: 70e9b34 dbe6ce5 Author: Alexey Goncharuk <agoncha...@gridgain.com> Authored: Wed Jul 8 16:14:21 2015 -0700 Committer: Alexey Goncharuk <agoncha...@gridgain.com> Committed: Wed Jul 8 16:14:21 2015 -0700 ---------------------------------------------------------------------- .../apache/ignite/cache/CacheTypeMetadata.java | 66 +- .../configuration/CacheConfiguration.java | 601 ++++++++++++++++++- .../processors/query/GridQueryIndexing.java | 16 - .../processors/query/GridQueryProcessor.java | 454 ++++++-------- .../ignite/internal/util/IgniteUtils.java | 5 +- .../cache/GridCacheAbstractSelfTest.java | 6 +- .../processors/query/h2/IgniteH2Indexing.java | 19 - 7 files changed, 843 insertions(+), 324 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2e8f713f/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 fcc80d4,bfc7b74..2e2baa1 --- 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 @@@ -130,15 -154,17 +156,17 @@@ public class GridQueryProcessor extend TypeDescriptor desc = new TypeDescriptor(); + // Key and value classes still can be available if they are primitive or JDK part. + // We need that to set correct types for _key and _val columns. ++ Class<?> keyCls = U.classForName(meta.getKeyType(), null); + Class<?> valCls = U.classForName(meta.getValueType(), null); + // TODO IGNITE-950 need class to check enableFieldsIndexing, but class may be absent on server node. + // TODO use old code if class is available on server node. CacheIndexedObjectImpl. - Class<?> keyCls = meta.getKeyType() != null ? U.classForName(meta.getKeyType(), null) : null; - Class<?> valCls = meta.getValueType() != null ? U.classForName(meta.getValueType(), null) : null; - desc.name(valCls != null ? typeName(valCls) : meta.getValueType()); + desc.name(meta.getSimpleValueType()); desc.valueClass(valCls != null ? valCls : Object.class); - desc.keyClass( - meta.getKeyType() == null ? - Object.class : - U.classForName(meta.getKeyType(), Object.class)); + desc.keyClass(keyCls != null ? keyCls : Object.class); TypeId typeId; @@@ -1240,17 -1142,17 +1150,22 @@@ * * @param meta Declared metadata. * @param d Type descriptor. + * @param propType PropertyType. * @throws IgniteCheckedException If failed. */ - private void processPortableMeta(CacheTypeMetadata meta, TypeDescriptor d) + private void processCacheTypeMeta(CacheTypeMetadata meta, TypeDescriptor d, PropertyType propType) throws IgniteCheckedException { + assert propType != CLASS_PROPERTY; + + Map<String,String> aliases = meta.getAliases(); + + if (aliases == null) + aliases = Collections.emptyMap(); + for (Map.Entry<String, Class<?>> entry : meta.getAscendingFields().entrySet()) { - PortableProperty prop = buildPortableProperty(entry.getKey(), entry.getValue(), aliases); + Property prop = propType == PORTABLE_PROPERTY ? - buildPortableProperty(entry.getKey(), entry.getValue()) : - buildIndexedFieldsProperty(entry.getKey(), entry.getValue()); ++ buildPortableProperty(entry.getKey(), entry.getValue(), aliases) : ++ buildIndexedFieldsProperty(entry.getKey(), entry.getValue(), aliases); d.addProperty(prop, false); @@@ -1262,9 -1164,7 +1177,9 @@@ } for (Map.Entry<String, Class<?>> entry : meta.getDescendingFields().entrySet()) { - PortableProperty prop = buildPortableProperty(entry.getKey(), entry.getValue(), aliases); + Property prop = propType == PORTABLE_PROPERTY ? - buildPortableProperty(entry.getKey(), entry.getValue()) : - buildIndexedFieldsProperty(entry.getKey(), entry.getValue()); ++ buildPortableProperty(entry.getKey(), entry.getValue(), aliases) : ++ buildIndexedFieldsProperty(entry.getKey(), entry.getValue(), aliases); d.addProperty(prop, false); @@@ -1276,9 -1176,7 +1191,9 @@@ } for (String txtIdx : meta.getTextFields()) { - PortableProperty prop = buildPortableProperty(txtIdx, String.class, aliases); + Property prop = propType == PORTABLE_PROPERTY ? - buildPortableProperty(txtIdx, String.class) : - buildIndexedFieldsProperty(txtIdx, String.class); ++ buildPortableProperty(txtIdx, String.class, aliases) : ++ buildIndexedFieldsProperty(txtIdx, String.class, aliases); d.addProperty(prop, false); @@@ -1296,9 -1194,7 +1211,9 @@@ int order = 0; for (Map.Entry<String, IgniteBiTuple<Class<?>, Boolean>> idxField : idxFields.entrySet()) { - PortableProperty prop = buildPortableProperty(idxField.getKey(), idxField.getValue().get1(), aliases); + Property prop = propType == PORTABLE_PROPERTY ? - buildPortableProperty(idxField.getKey(), idxField.getValue().get1()) : - buildIndexedFieldsProperty(idxField.getKey(), idxField.getValue().get1()); ++ buildPortableProperty(idxField.getKey(), idxField.getValue().get1(), aliases) : ++ buildIndexedFieldsProperty(idxField.getKey(), idxField.getValue().get1(), aliases); d.addProperty(prop, false); @@@ -1312,9 -1208,7 +1227,9 @@@ } for (Map.Entry<String, Class<?>> entry : meta.getQueryFields().entrySet()) { - PortableProperty prop = buildPortableProperty(entry.getKey(), entry.getValue(), aliases); + Property prop = propType == PORTABLE_PROPERTY ? - buildPortableProperty(entry.getKey(), entry.getValue()) : - buildIndexedFieldsProperty(entry.getKey(), entry.getValue()); ++ buildPortableProperty(entry.getKey(), entry.getValue(), aliases) : ++ buildIndexedFieldsProperty(entry.getKey(), entry.getValue(), aliases); if (!d.props.containsKey(prop.name())) d.addProperty(prop, false); @@@ -2201,11 -2013,9 +2138,18 @@@ } /** + * The way to index. + */ + private enum IndexType { + ASC, DESC, TEXT + } ++ ++ /** + * + */ + enum PropertyType { + CLASS_PROPERTY, + PORTABLE_PROPERTY, + INDEXED_FIELDS_PROPERTY + } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2e8f713f/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java ----------------------------------------------------------------------