Search in sources :

Example 96 with QueryEntity

use of org.apache.ignite.cache.QueryEntity in project ignite by apache.

the class IgniteCacheQueriesLoadTest1 method getTraderCfg.

/**
 * @param parentCfg Parent config.
 * @return Configuration.
 */
private static CacheConfiguration<Object, Object> getTraderCfg(CacheConfiguration<Object, Object> parentCfg) {
    CacheConfiguration<Object, Object> traderCfg = new CacheConfiguration<>(parentCfg);
    traderCfg.setName(TRADER_CACHE);
    String strCls = String.class.getCanonicalName();
    LinkedHashMap<String, String> qryFields = new LinkedHashMap<>();
    qryFields.put(ID, strCls);
    qryFields.put(FIRSTNAME, strCls);
    qryFields.put(SECONDNAME, strCls);
    qryFields.put(EMAIL, strCls);
    QueryEntity qryEntity = new QueryEntity();
    qryEntity.setValueType(TRADER);
    qryEntity.setKeyType(strCls);
    qryEntity.setFields(qryFields);
    LinkedHashMap<String, Boolean> grpIdx = new LinkedHashMap<>();
    grpIdx.put(FIRSTNAME, false);
    grpIdx.put(SECONDNAME, false);
    qryEntity.setIndexes(Arrays.asList(new QueryIndex(ID, true), new QueryIndex(grpIdx, QueryIndexType.FULLTEXT)));
    traderCfg.setQueryEntities(Collections.singleton(qryEntity));
    return traderCfg;
}
Also used : QueryIndex(org.apache.ignite.cache.QueryIndex) BinaryObject(org.apache.ignite.binary.BinaryObject) QueryEntity(org.apache.ignite.cache.QueryEntity) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) LinkedHashMap(java.util.LinkedHashMap)

Example 97 with QueryEntity

use of org.apache.ignite.cache.QueryEntity in project ignite by apache.

the class IgniteCacheQueriesLoadTest1 method getDepositHistoryCfg.

/**
 * @param parentCfg Parent config.
 * @return Configuration.
 */
private static CacheConfiguration<Object, Object> getDepositHistoryCfg(CacheConfiguration<Object, Object> parentCfg) {
    CacheConfiguration<Object, Object> depositHistCfg = new CacheConfiguration<>(parentCfg);
    depositHistCfg.setName(DEPOSIT_HISTORY_CACHE);
    String strCls = String.class.getCanonicalName();
    String dblCls = Double.class.getCanonicalName();
    String dtCls = Date.class.getCanonicalName();
    LinkedHashMap<String, String> qryFields = new LinkedHashMap<>();
    qryFields.put(ID, strCls);
    qryFields.put(DEPOSIT_ID, strCls);
    qryFields.put(BUSINESS_DAY, dtCls);
    qryFields.put(BALANCE, dblCls);
    QueryEntity qryEntity = new QueryEntity();
    qryEntity.setValueType(OPERATION);
    qryEntity.setKeyType(strCls);
    qryEntity.setFields(qryFields);
    qryEntity.setIndexes(Arrays.asList(new QueryIndex(ID, true), new QueryIndex(DEPOSIT_ID, true)));
    depositHistCfg.setQueryEntities(Collections.singleton(qryEntity));
    return depositHistCfg;
}
Also used : QueryIndex(org.apache.ignite.cache.QueryIndex) BinaryObject(org.apache.ignite.binary.BinaryObject) QueryEntity(org.apache.ignite.cache.QueryEntity) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

QueryEntity (org.apache.ignite.cache.QueryEntity)97 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)59 QueryIndex (org.apache.ignite.cache.QueryIndex)46 LinkedHashMap (java.util.LinkedHashMap)38 ArrayList (java.util.ArrayList)33 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)17 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)12 HashSet (java.util.HashSet)8 NearCacheConfiguration (org.apache.ignite.configuration.NearCacheConfiguration)8 HashMap (java.util.HashMap)7 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)7 CacheKeyConfiguration (org.apache.ignite.cache.CacheKeyConfiguration)7 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)6 BinaryObject (org.apache.ignite.binary.BinaryObject)5 DynamicCacheDescriptor (org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor)5 RendezvousAffinityFunction (org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction)4 BinaryMarshaller (org.apache.ignite.internal.binary.BinaryMarshaller)4 SchemaOperationException (org.apache.ignite.internal.processors.query.schema.SchemaOperationException)4 List (java.util.List)3 Map (java.util.Map)3