本文整理汇总了Java中com.espertech.esper.epl.join.table.EventTableAndNamePair类的典型用法代码示例。如果您正苦于以下问题:Java EventTableAndNamePair类的具体用法?Java EventTableAndNamePair怎么用?Java EventTableAndNamePair使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EventTableAndNamePair类属于com.espertech.esper.epl.join.table包,在下文中一共展示了EventTableAndNamePair类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addExplicitIndexOrReuse
import com.espertech.esper.epl.join.table.EventTableAndNamePair; //导入依赖的package包/类
public Pair<IndexMultiKey, EventTableAndNamePair> addExplicitIndexOrReuse(
boolean unique,
List<IndexedPropDesc> hashProps,
List<IndexedPropDesc> btreeProps,
EventAdvancedIndexProvisionDesc advancedIndexProvisionDesc,
Iterable<EventBean> prefilledEvents,
EventType indexedType,
String indexName,
AgentInstanceContext agentInstanceContext,
Object optionalSerde) {
if (hashProps.isEmpty() && btreeProps.isEmpty() && advancedIndexProvisionDesc == null) {
throw new IllegalArgumentException("Invalid zero element list for hash and btree columns");
}
// Get an existing table, if any, matching the exact requirement
IndexMultiKey indexPropKeyMatch = EventTableIndexUtil.findExactMatchNameAndType(tableIndexesRefCount.keySet(), unique, hashProps, btreeProps, advancedIndexProvisionDesc == null ? null : advancedIndexProvisionDesc.getIndexDesc());
if (indexPropKeyMatch != null) {
EventTableIndexRepositoryEntry refTablePair = tableIndexesRefCount.get(indexPropKeyMatch);
return new Pair<IndexMultiKey, EventTableAndNamePair>(indexPropKeyMatch, new EventTableAndNamePair(refTablePair.getTable(), refTablePair.getOptionalIndexName()));
}
return addIndex(unique, hashProps, btreeProps, advancedIndexProvisionDesc, prefilledEvents, indexedType, indexName, false, agentInstanceContext, optionalSerde);
}
示例2: addExplicitIndexOrReuse
import com.espertech.esper.epl.join.table.EventTableAndNamePair; //导入依赖的package包/类
public Pair<IndexMultiKey, EventTableAndNamePair> addExplicitIndexOrReuse(
boolean unique,
List<IndexedPropDesc> hashProps,
List<IndexedPropDesc> btreeProps,
Iterable<EventBean> prefilledEvents,
EventType indexedType,
String indexName)
{
if (hashProps.isEmpty() && btreeProps.isEmpty()) {
throw new IllegalArgumentException("Invalid zero element list for hash and btree columns");
}
// Get an existing table, if any, matching the exact requirement
IndexMultiKey indexPropKeyMatch = findExactMatchNameAndType(tableIndexesRefCount.keySet(), unique, hashProps, btreeProps);
if (indexPropKeyMatch != null) {
NamedWindowIndexRepEntry refTablePair = tableIndexesRefCount.get(indexPropKeyMatch);
refTablePair.setRefCount(refTablePair.getRefCount() + 1);
return new Pair<IndexMultiKey, EventTableAndNamePair>(indexPropKeyMatch, new EventTableAndNamePair(refTablePair.getTable(), refTablePair.getOptionalIndexName()));
}
return addIndex(unique, hashProps, btreeProps, prefilledEvents, indexedType, indexName, false);
}
示例3: getTableClassNamePairs
import com.espertech.esper.epl.join.table.EventTableAndNamePair; //导入依赖的package包/类
private static IndexNameAndDescPair[] getTableClassNamePairs(EventTableAndNamePair[] pairs) {
if (pairs == null) {
return new IndexNameAndDescPair[0];
}
IndexNameAndDescPair[] names = new IndexNameAndDescPair[pairs.length];
for (int i = 0; i < pairs.length; i++) {
names[i] = new IndexNameAndDescPair(pairs[i].getIndexName(), pairs[i].getEventTable().getProviderClass().getSimpleName());
}
return names;
}
示例4: findTable
import com.espertech.esper.epl.join.table.EventTableAndNamePair; //导入依赖的package包/类
public Pair<IndexMultiKey, EventTableAndNamePair> findTable(Set<String> keyPropertyNames, Set<String> rangePropertyNames, List<IndexHintInstruction> optionalIndexHintInstructions) {
Pair<IndexMultiKey, EventTableIndexEntryBase> pair = EventTableIndexUtil.findIndexBestAvailable(tableIndexesRefCount, keyPropertyNames, rangePropertyNames, optionalIndexHintInstructions);
if (pair == null) {
return null;
}
EventTable tableFound = ((EventTableIndexRepositoryEntry) pair.getSecond()).getTable();
return new Pair<IndexMultiKey, EventTableAndNamePair>(pair.getFirst(), new EventTableAndNamePair(tableFound, pair.getSecond().getOptionalIndexName()));
}
示例5: addIndex
import com.espertech.esper.epl.join.table.EventTableAndNamePair; //导入依赖的package包/类
private Pair<IndexMultiKey, EventTableAndNamePair> addIndex(boolean unique, List<IndexedPropDesc> hashProps, List<IndexedPropDesc> btreeProps, EventAdvancedIndexProvisionDesc advancedIndexProvisionDesc, Iterable<EventBean> prefilledEvents, EventType indexedType, String indexName, boolean mustCoerce, AgentInstanceContext agentInstanceContext, Object optionalSerde) {
// not resolved as full match and not resolved as unique index match, allocate
IndexMultiKey indexPropKey = new IndexMultiKey(unique, hashProps, btreeProps, advancedIndexProvisionDesc == null ? null : advancedIndexProvisionDesc.getIndexDesc());
IndexedPropDesc[] indexedPropDescs = hashProps.toArray(new IndexedPropDesc[hashProps.size()]);
String[] indexProps = IndexedPropDesc.getIndexProperties(indexedPropDescs);
Class[] indexCoercionTypes = IndexedPropDesc.getCoercionTypes(indexedPropDescs);
if (!mustCoerce) {
indexCoercionTypes = null;
}
IndexedPropDesc[] rangePropDescs = btreeProps.toArray(new IndexedPropDesc[btreeProps.size()]);
String[] rangeProps = IndexedPropDesc.getIndexProperties(rangePropDescs);
Class[] rangeCoercionTypes = IndexedPropDesc.getCoercionTypes(rangePropDescs);
QueryPlanIndexItem indexItem = new QueryPlanIndexItem(indexProps, indexCoercionTypes, rangeProps, rangeCoercionTypes, unique, advancedIndexProvisionDesc);
EventTable table = EventTableUtil.buildIndex(agentInstanceContext, 0, indexItem, indexedType, true, unique, indexName, optionalSerde, false);
// fill table since its new
EventBean[] events = new EventBean[1];
for (EventBean prefilledEvent : prefilledEvents) {
events[0] = prefilledEvent;
table.add(events, agentInstanceContext);
}
// add table
tables.add(table);
// add index, reference counted
tableIndexesRefCount.put(indexPropKey, new EventTableIndexRepositoryEntry(indexName, table));
return new Pair<IndexMultiKey, EventTableAndNamePair>(indexPropKey, new EventTableAndNamePair(table, indexName));
}
示例6: addIndex
import com.espertech.esper.epl.join.table.EventTableAndNamePair; //导入依赖的package包/类
private Pair<IndexMultiKey, EventTableAndNamePair> addIndex(boolean unique, List<IndexedPropDesc> hashProps, List<IndexedPropDesc> btreeProps, Iterable<EventBean> prefilledEvents, EventType indexedType, String indexName, boolean mustCoerce) {
// not resolved as full match and not resolved as unique index match, allocate
IndexMultiKey indexPropKey = new IndexMultiKey(unique, hashProps, btreeProps);
IndexedPropDesc[] indexedPropDescs = hashProps.toArray(new IndexedPropDesc[hashProps.size()]);
String[] indexProps = IndexedPropDesc.getIndexProperties(indexedPropDescs);
Class[] indexCoercionTypes = IndexedPropDesc.getCoercionTypes(indexedPropDescs);
if (!mustCoerce) {
indexCoercionTypes = null;
}
IndexedPropDesc[] rangePropDescs = btreeProps.toArray(new IndexedPropDesc[btreeProps.size()]);
String[] rangeProps = IndexedPropDesc.getIndexProperties(rangePropDescs);
Class[] rangeCoercionTypes = IndexedPropDesc.getCoercionTypes(rangePropDescs);
QueryPlanIndexItem indexItem = new QueryPlanIndexItem(indexProps, indexCoercionTypes, rangeProps, rangeCoercionTypes, false);
EventTable table = EventTableUtil.buildIndex(0, indexItem, indexedType, true, unique, indexName);
// fill table since its new
EventBean[] events = new EventBean[1];
for (EventBean prefilledEvent : prefilledEvents)
{
events[0] = prefilledEvent;
table.add(events);
}
// add table
tables.add(table);
// add index, reference counted
tableIndexesRefCount.put(indexPropKey, new NamedWindowIndexRepEntry(table, indexName, 1));
return new Pair<IndexMultiKey, EventTableAndNamePair>(indexPropKey, new EventTableAndNamePair(table, indexName));
}
示例7: addExplicitIndex
import com.espertech.esper.epl.join.table.EventTableAndNamePair; //导入依赖的package包/类
public void addExplicitIndex(String explicitIndexName, QueryPlanIndexItem desc, EventType eventType, Iterable<EventBean> dataWindowContents, AgentInstanceContext agentInstanceContext, Object optionalSerde) {
Pair<IndexMultiKey, EventTableAndNamePair> pair = addExplicitIndexOrReuse(desc.isUnique(), desc.getHashPropsAsList(), desc.getBtreePropsAsList(), desc.getAdvancedIndexProvisionDesc(), dataWindowContents, eventType, explicitIndexName, agentInstanceContext, optionalSerde);
explicitIndexes.put(explicitIndexName, pair.getSecond().getEventTable());
}
示例8: reference
import com.espertech.esper.epl.join.table.EventTableAndNamePair; //导入依赖的package包/类
private Pair<IndexMultiKey, EventTableAndNamePair> reference(IndexMultiKey found) {
NamedWindowIndexRepEntry refTablePair = tableIndexesRefCount.get(found);
refTablePair.setRefCount(refTablePair.getRefCount() + 1);
return new Pair<IndexMultiKey, EventTableAndNamePair>(found, new EventTableAndNamePair(refTablePair.getTable(), refTablePair.getOptionalIndexName()));
}
示例9: findTable
import com.espertech.esper.epl.join.table.EventTableAndNamePair; //导入依赖的package包/类
public Pair<IndexMultiKey, EventTableAndNamePair> findTable(Set<String> keyPropertyNames, Set<String> rangePropertyNames, Map<String, EventTable> explicitIndexNames, IndexHint optionalIndexHint) {
if (keyPropertyNames.isEmpty() && rangePropertyNames.isEmpty()) {
return null;
}
// determine candidates
List<IndexedPropDesc> hashProps = new ArrayList<IndexedPropDesc>();
for (String keyPropertyName : keyPropertyNames) {
hashProps.add(new IndexedPropDesc(keyPropertyName, null));
}
List<IndexedPropDesc> rangeProps = new ArrayList<IndexedPropDesc>();
for (String rangePropertyName : rangePropertyNames) {
rangeProps.add(new IndexedPropDesc(rangePropertyName, null));
}
Map<IndexMultiKey, NamedWindowIndexRepEntry> indexCandidates = findCandidates(hashProps, rangeProps);
// handle hint
if (optionalIndexHint != null) {
List<IndexHintInstruction> instructions = optionalIndexHint.getInstructionsFireAndForget();
IndexMultiKey found = handleIndexHint(indexCandidates, instructions);
if (found != null) {
return getPair(found);
}
}
// no candidates
if (indexCandidates == null || indexCandidates.isEmpty()) {
if (log.isDebugEnabled()) {
log.debug("No index found.");
}
return null;
}
// take the table that has a unique index
for (Map.Entry<IndexMultiKey, NamedWindowIndexRepEntry> entry : indexCandidates.entrySet()) {
if (entry.getKey().isUnique()) {
return getPair(entry.getKey());
}
}
// take the best available table
IndexMultiKey indexMultiKey;
List<IndexMultiKey> indexes = new ArrayList<IndexMultiKey>(indexCandidates.keySet());
if (indexes.size() > 1) {
Comparator<IndexMultiKey> comparator = new Comparator<IndexMultiKey>() {
public int compare(IndexMultiKey o1, IndexMultiKey o2)
{
String[] indexedProps1 = IndexedPropDesc.getIndexProperties(o1.getHashIndexedProps());
String[] indexedProps2 = IndexedPropDesc.getIndexProperties(o2.getHashIndexedProps());
if (indexedProps1.length > indexedProps2.length) {
return -1; // sort desc by count columns
}
if (indexedProps1.length == indexedProps2.length) {
return 0;
}
return 1;
}
};
Collections.sort(indexes,comparator);
}
indexMultiKey = indexes.get(0);
return getPair(indexMultiKey);
}
示例10: getPair
import com.espertech.esper.epl.join.table.EventTableAndNamePair; //导入依赖的package包/类
private Pair<IndexMultiKey, EventTableAndNamePair> getPair(IndexMultiKey indexMultiKey) {
NamedWindowIndexRepEntry indexFound = tableIndexesRefCount.get(indexMultiKey);
EventTable tableFound = indexFound.getTable();
return new Pair<IndexMultiKey, EventTableAndNamePair>(indexMultiKey, new EventTableAndNamePair(tableFound, indexFound.getOptionalIndexName()));
}