本文整理汇总了Java中com.espertech.esper.epl.join.hint.IndexHint类的典型用法代码示例。如果您正苦于以下问题:Java IndexHint类的具体用法?Java IndexHint怎么用?Java IndexHint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IndexHint类属于com.espertech.esper.epl.join.hint包,在下文中一共展示了IndexHint类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: StatementAgentInstanceFactoryOnTriggerTable
import com.espertech.esper.epl.join.hint.IndexHint; //导入依赖的package包/类
public StatementAgentInstanceFactoryOnTriggerTable(StatementContext statementContext, StatementSpecCompiled statementSpec, EPServicesContext services, ViewableActivator activator, SubSelectStrategyCollection subSelectStrategyCollection, ResultSetProcessorFactoryDesc resultSetProcessorPrototype, ExprNode validatedJoin, TableOnViewFactory onExprFactory, EventType activatorResultEventType, TableMetadata tableMetadata, ResultSetProcessorFactoryDesc outputResultSetProcessorPrototype, OutputProcessViewFactory outputProcessViewFactory)
throws ExprValidationException {
super(statementContext, statementSpec, services, activator, subSelectStrategyCollection);
this.resultSetProcessorPrototype = resultSetProcessorPrototype;
this.onExprFactory = onExprFactory;
this.outputResultSetProcessorPrototype = outputResultSetProcessorPrototype;
this.outputProcessViewFactory = outputProcessViewFactory;
StatementAgentInstanceFactoryOnTriggerNamedWindow.IndexHintPair pair = StatementAgentInstanceFactoryOnTriggerNamedWindow.getIndexHintPair(statementContext, statementSpec);
IndexHint indexHint = pair.getIndexHint();
ExcludePlanHint excludePlanHint = pair.getExcludePlanHint();
queryPlanResult = SubordinateQueryPlanner.planOnExpression(
validatedJoin, activatorResultEventType, indexHint, true, -1, excludePlanHint,
false, tableMetadata.getEventTableIndexMetadataRepo(), tableMetadata.getInternalEventType(),
tableMetadata.getUniqueKeyProps(), true, statementContext.getStatementName(), statementContext.getStatementId(), statementContext.getAnnotations(), statementContext.getEngineImportService());
if (queryPlanResult.getIndexDescs() != null) {
for (int i = 0; i < queryPlanResult.getIndexDescs().length; i++) {
tableMetadata.addIndexReference(queryPlanResult.getIndexDescs()[i].getIndexName(), statementContext.getStatementName());
}
}
SubordinateQueryPlannerUtil.queryPlanLogOnExpr(tableMetadata.isQueryPlanLogging(), TableServiceImpl.getQueryPlanLog(),
queryPlanResult, statementContext.getAnnotations(), statementContext.getEngineImportService());
}
示例2: findIndex
import com.espertech.esper.epl.join.hint.IndexHint; //导入依赖的package包/类
private static Pair<IndexMultiKey, EventTableAndNamePair> findIndex(Set<String> keyNamesAvailable, Set<String> rangeNamesAvailable, EventTableIndexRepository indexRepository, VirtualDWView virtualDataWindow, Annotation[] annotations) {
if (virtualDataWindow != null) {
Pair<IndexMultiKey, EventTable> tablePairNoName = virtualDataWindow.getFireAndForgetDesc(keyNamesAvailable, rangeNamesAvailable);
return new Pair<>(tablePairNoName.getFirst(), new EventTableAndNamePair(tablePairNoName.getSecond(), null));
}
IndexHint indexHint = IndexHint.getIndexHint(annotations);
List<IndexHintInstruction> optionalIndexHintInstructions = indexHint != null ? indexHint.getInstructionsFireAndForget() : null;
return indexRepository.findTable(keyNamesAvailable, rangeNamesAvailable, optionalIndexHintInstructions);
}
示例3: StatementAgentInstanceFactoryOnTriggerNamedWindow
import com.espertech.esper.epl.join.hint.IndexHint; //导入依赖的package包/类
public StatementAgentInstanceFactoryOnTriggerNamedWindow(final StatementContext statementContext, StatementSpecCompiled statementSpec, EPServicesContext services, ViewableActivator activator, SubSelectStrategyCollection subSelectStrategyCollection, ResultSetProcessorFactoryDesc resultSetProcessorPrototype, ExprNode validatedJoin, ResultSetProcessorFactoryDesc outputResultSetProcessorPrototype, NamedWindowOnExprFactory onExprFactory, OutputProcessViewFactory outputProcessViewFactory, EventType activatorResultEventType, final NamedWindowProcessor processor, List<StopCallback> stopCallbacks)
throws ExprValidationException {
super(statementContext, statementSpec, services, activator, subSelectStrategyCollection);
this.resultSetProcessorPrototype = resultSetProcessorPrototype;
this.outputResultSetProcessorPrototype = outputResultSetProcessorPrototype;
this.onExprFactory = onExprFactory;
this.outputProcessViewFactory = outputProcessViewFactory;
this.processor = processor;
IndexHintPair pair = getIndexHintPair(statementContext, statementSpec);
IndexHint indexHint = pair.getIndexHint();
ExcludePlanHint excludePlanHint = pair.getExcludePlanHint();
queryPlan = SubordinateQueryPlanner.planOnExpression(
validatedJoin, activatorResultEventType, indexHint, processor.isEnableSubqueryIndexShare(), -1, excludePlanHint,
processor.isVirtualDataWindow(), processor.getEventTableIndexMetadataRepo(), processor.getNamedWindowType(),
processor.getOptionalUniqueKeyProps(), false, statementContext.getStatementName(), statementContext.getStatementId(), statementContext.getAnnotations(), statementContext.getEngineImportService());
if (queryPlan.getIndexDescs() != null) {
SubordinateQueryPlannerUtil.addIndexMetaAndRef(queryPlan.getIndexDescs(), processor.getEventTableIndexMetadataRepo(), statementContext.getStatementName());
stopCallbacks.add(new StopCallback() {
public void stop() {
for (int i = 0; i < queryPlan.getIndexDescs().length; i++) {
boolean last = processor.getEventTableIndexMetadataRepo().removeIndexReference(queryPlan.getIndexDescs()[i].getIndexMultiKey(), statementContext.getStatementName());
if (last) {
processor.getEventTableIndexMetadataRepo().removeIndex(queryPlan.getIndexDescs()[i].getIndexMultiKey());
processor.removeAllInstanceIndexes(queryPlan.getIndexDescs()[i].getIndexMultiKey());
}
}
}
});
}
SubordinateQueryPlannerUtil.queryPlanLogOnExpr(processor.getRootView().isQueryPlanLogging(), NamedWindowRootView.getQueryPlanLog(),
queryPlan, statementContext.getAnnotations(), statementContext.getEngineImportService());
}
示例4: getIndexHintPair
import com.espertech.esper.epl.join.hint.IndexHint; //导入依赖的package包/类
protected static IndexHintPair getIndexHintPair(StatementContext statementContext, StatementSpecCompiled statementSpec)
throws ExprValidationException {
IndexHint indexHint = IndexHint.getIndexHint(statementContext.getAnnotations());
ExcludePlanHint excludePlanHint = null;
if (statementSpec.getOnTriggerDesc() instanceof OnTriggerWindowDesc) {
OnTriggerWindowDesc onTriggerWindowDesc = (OnTriggerWindowDesc) statementSpec.getOnTriggerDesc();
String[] streamNames = {onTriggerWindowDesc.getOptionalAsName(), statementSpec.getStreamSpecs()[0].getOptionalStreamName()};
excludePlanHint = ExcludePlanHint.getHint(streamNames, statementContext);
}
return new IndexHintPair(indexHint, excludePlanHint);
}
示例5: addOnExpr
import com.espertech.esper.epl.join.hint.IndexHint; //导入依赖的package包/类
/**
* Add an on-trigger view that, using a lookup strategy, looks up from the named window and may select or delete rows.
* @return base view for on-trigger expression
*/
public NamedWindowOnExprBaseView addOnExpr(NamedWindowOnExprFactory onExprFactory, AgentInstanceContext agentInstanceContext, ExprNode joinExpr, EventType filterEventType, ResultSetProcessor resultSetProcessor)
{
IndexHint indexHint = IndexHint.getIndexHint(agentInstanceContext.getStatementContext().getAnnotations());
// Determine strategy for deletion and index table to use (if any)
Pair<NamedWindowLookupStrategy,EventTableAndNamePair> strategy = getStrategyPair(agentInstanceContext.getStatementContext().getStatementName(), agentInstanceContext.getStatementContext().getStatementId(), agentInstanceContext.getStatementContext().getAnnotations(), joinExpr, filterEventType, indexHint, rootView.isEnableIndexShare(), -1);
if (rootView.isQueryPlanLogging() && rootView.getQueryPlanLog().isInfoEnabled()) {
String prefix = "On-Expr ";
String indexName = strategy.getSecond() != null ? strategy.getSecond().getIndexName() : null;
String indexText = indexName != null ? "index " + indexName + " " : "(implicit) ";
rootView.getQueryPlanLog().info(prefix + "strategy " + strategy.getFirst().toQueryPlan());
rootView.getQueryPlanLog().info(prefix + indexText + "table " + ((strategy.getSecond() == null) ? "N/A" : strategy.getSecond().getEventTable().toQueryPlan()));
QueryPlanIndexHook hook = QueryPlanIndexHookUtil.getHook(agentInstanceContext.getStatementContext().getAnnotations());
if (hook != null) {
hook.namedWindowOnExpr(new QueryPlanIndexDescOnExpr(strategy.getSecond().getIndexName(),
strategy.getSecond().getEventTable().getClass().getSimpleName()));
}
}
// If a new table is required, add that table to be updated
if (strategy.getSecond() != null)
{
tablePerMultiLookup.put(strategy.getFirst(), strategy.getSecond().getEventTable());
}
return onExprFactory.make(strategy.getFirst(), this, agentInstanceContext, resultSetProcessor);
}
示例6: getSubqueryStrategyPair
import com.espertech.esper.epl.join.hint.IndexHint; //导入依赖的package包/类
private Pair<SubordTableLookupStrategy, EventTableAndNamePair> getSubqueryStrategyPair(String accessedByStatementName, String accessedByStatementId, Annotation[] accessedByStmtAnnotations, EventType[] outerStreamTypes, SubordPropPlan joinDesc, boolean isNWOnTrigger, boolean forceTableScan, IndexHint optionalIndexHint, boolean isIndexShare, int subqueryNumber) {
Pair<IndexKeyInfo, EventTableAndNamePair> accessDesc = findCreateIndex(joinDesc, optionalIndexHint, isIndexShare, subqueryNumber);
if (accessDesc == null) {
return null;
}
IndexKeyInfo indexKeyInfo = accessDesc.getFirst();
EventTableAndNamePair eventTableAndName = accessDesc.getSecond();
EventTable eventTable = accessDesc.getSecond().getEventTable();
List<SubordPropHashKey> hashKeys = indexKeyInfo.getOrderedHashProperties();
CoercionDesc hashKeyCoercionTypes = indexKeyInfo.getOrderedKeyCoercionTypes();
List<SubordPropRangeKey> rangeKeys = indexKeyInfo.getOrderedRangeDesc();
CoercionDesc rangeKeyCoercionTypes = indexKeyInfo.getOrderedRangeCoercionTypes();
SubordTableLookupStrategy lookupStrategy;
if (isVirtualDataWindow()) {
VirtualDWView viewExternal = getVirtualDataWindow();
lookupStrategy = viewExternal.getSubordinateLookupStrategy(accessedByStatementName, accessedByStatementId, accessedByStmtAnnotations, outerStreamTypes,
hashKeys, hashKeyCoercionTypes, rangeKeys, rangeKeyCoercionTypes, isNWOnTrigger, eventTable, joinDesc, forceTableScan);
}
else {
if (forceTableScan) {
lookupStrategy = null;
}
else {
SubordTableLookupStrategyFactory lookupStrategyFactory = SubordinateTableLookupStrategyUtil.getLookupStrategy(outerStreamTypes,
hashKeys, hashKeyCoercionTypes, rangeKeys, rangeKeyCoercionTypes, isNWOnTrigger);
lookupStrategy = lookupStrategyFactory.makeStrategy(eventTable);
}
}
return new Pair<SubordTableLookupStrategy,EventTableAndNamePair>(lookupStrategy, eventTableAndName);
}
示例7: getStrategyPair
import com.espertech.esper.epl.join.hint.IndexHint; //导入依赖的package包/类
private Pair<NamedWindowLookupStrategy,EventTableAndNamePair> getStrategyPair(String accessedByStatementName, String accessedByStatementId, Annotation[] accessedByStmtAnnotations, ExprNode joinExpr, EventType filterEventType, IndexHint optionalIndexHint, boolean isIndexShare, int subqueryNumber)
{
EventType[] allStreamsZeroIndexed = new EventType[] {rootView.getEventType(), filterEventType};
EventType[] outerStreams = new EventType[] {filterEventType};
SubordPropPlan joinedPropPlan = QueryPlanIndexBuilder.getJoinProps(joinExpr, 1, allStreamsZeroIndexed);
// No join expression means delete all
if (joinExpr == null && (!(isVirtualDataWindow())))
{
return new Pair<NamedWindowLookupStrategy,EventTableAndNamePair>(new NamedWindowLookupStrategyAllRows(dataWindowContents), null);
}
// Here the stream offset is 1 as the named window lookup provides the arriving event in stream 1
Pair<SubordTableLookupStrategy,EventTableAndNamePair> lookupPair = getSubqueryStrategyPair(accessedByStatementName, accessedByStatementId, accessedByStmtAnnotations, outerStreams, joinedPropPlan, true, false, optionalIndexHint, isIndexShare, subqueryNumber);
if (lookupPair == null) {
return new Pair<NamedWindowLookupStrategy,EventTableAndNamePair>(new NamedWindowLookupStrategyTableScan(joinExpr.getExprEvaluator(), dataWindowContents), null);
}
if (joinExpr == null) { // it can be null when using virtual data window
return new Pair<NamedWindowLookupStrategy,EventTableAndNamePair>(
new NamedWindowLookupStrategyIndexedUnfiltered(lookupPair.getFirst()),
lookupPair.getSecond());
}
else {
return new Pair<NamedWindowLookupStrategy,EventTableAndNamePair>(
new NamedWindowLookupStrategyIndexed(joinExpr.getExprEvaluator(), lookupPair.getFirst()),
lookupPair.getSecond());
}
}
示例8: getAddSubqueryLookupStrategy
import com.espertech.esper.epl.join.hint.IndexHint; //导入依赖的package包/类
public SubordTableLookupStrategy getAddSubqueryLookupStrategy(String accessedByStatementName, String accessedByStatementId, Annotation[] accessedByStmtAnnotations, EventType[] eventTypesPerStream, SubordPropPlan joinDesc, boolean fullTableScan, int subqueryNum, IndexHint optionalIndexHint) {
// NOTE: key stream nums are relative to the outer streams, i.e. 0=first outer, 1=second outer (index stream is implied and not counted).
// Here the stream offset for key is zero as in a subquery only the outer events are provided in events-per-stream.
Pair<SubordTableLookupStrategy,EventTableAndNamePair> strategyTablePair = getSubqueryStrategyPair(accessedByStatementName, accessedByStatementId, accessedByStmtAnnotations, eventTypesPerStream, joinDesc, false, fullTableScan, optionalIndexHint, rootView.isEnableIndexShare(), subqueryNum);
if (strategyTablePair == null || strategyTablePair.getFirst() == null) {
if (rootView.isQueryPlanLogging() && rootView.getQueryPlanLog().isInfoEnabled()) {
rootView.getQueryPlanLog().info("shared, full table scan");
}
return new SubordFullTableScanLookupStrategyLocking(dataWindowContents, agentInstanceContext.getEpStatementAgentInstanceHandle().getStatementAgentInstanceLock());
}
SubordIndexedTableLookupStrategyLocking locking = new SubordIndexedTableLookupStrategyLocking(strategyTablePair.getFirst(), agentInstanceContext.getEpStatementAgentInstanceHandle().getStatementAgentInstanceLock());
tablePerSingleLookup.put(locking, strategyTablePair.getSecond().getEventTable());
if (rootView.isQueryPlanLogging() && rootView.getQueryPlanLog().isInfoEnabled()) {
String prefix = "Subquery " + subqueryNum + " ";
String indexName = strategyTablePair.getSecond().getIndexName();
String indexText = indexName != null ? "index " + indexName + " " : "(implicit) ";
rootView.getQueryPlanLog().info(prefix + "shared index");
rootView.getQueryPlanLog().info(prefix + "strategy " + strategyTablePair.getFirst().toQueryPlan());
rootView.getQueryPlanLog().info(prefix + indexText + "table " + strategyTablePair.getSecond().getEventTable().toQueryPlan());
QueryPlanIndexHook hook = QueryPlanIndexHookUtil.getHook(accessedByStmtAnnotations);
if (hook != null) {
hook.subquery(new QueryPlanIndexDescSubquery(strategyTablePair.getSecond().getIndexName(),
strategyTablePair.getSecond().getEventTable().getClass().getSimpleName(), subqueryNum));
}
}
return locking;
}
示例9: planOnExpression
import com.espertech.esper.epl.join.hint.IndexHint; //导入依赖的package包/类
public static SubordinateWMatchExprQueryPlanResult planOnExpression(
ExprNode joinExpr,
EventType filterEventType,
IndexHint optionalIndexHint,
boolean isIndexShare,
int subqueryNumber,
ExcludePlanHint excludePlanHint,
boolean isVirtualDataWindow,
EventTableIndexMetadata indexMetadata,
EventType eventTypeIndexed,
Set<String> optionalUniqueKeyProps,
boolean onlyUseExistingIndexes,
String statementName,
int statementId,
Annotation[] annotations,
EngineImportService engineImportService) {
EventType[] allStreamsZeroIndexed = new EventType[]{eventTypeIndexed, filterEventType};
EventType[] outerStreams = new EventType[]{filterEventType};
SubordPropPlan joinedPropPlan = QueryPlanIndexBuilder.getJoinProps(joinExpr, 1, allStreamsZeroIndexed, excludePlanHint);
// No join expression means all
if (joinExpr == null && !isVirtualDataWindow) {
return new SubordinateWMatchExprQueryPlanResult(new SubordWMatchExprLookupStrategyFactoryAllUnfiltered(), null);
}
SubordinateQueryPlanDesc queryPlanDesc = planSubquery(outerStreams, joinedPropPlan, true, false, optionalIndexHint, isIndexShare, subqueryNumber,
isVirtualDataWindow, indexMetadata, optionalUniqueKeyProps, onlyUseExistingIndexes, statementName, statementId, annotations);
ExprEvaluator joinEvaluator = joinExpr == null ? null : ExprNodeCompiler.allocateEvaluator(joinExpr.getForge(), engineImportService, SubordinateQueryPlanner.class, false, statementName);
if (queryPlanDesc == null) {
return new SubordinateWMatchExprQueryPlanResult(new SubordWMatchExprLookupStrategyFactoryAllFiltered(joinEvaluator), null);
}
if (joinExpr == null) { // it can be null when using virtual data window
return new SubordinateWMatchExprQueryPlanResult(
new SubordWMatchExprLookupStrategyFactoryIndexedUnfiltered(queryPlanDesc.getLookupStrategyFactory()), queryPlanDesc.getIndexDescs());
} else {
return new SubordinateWMatchExprQueryPlanResult(
new SubordWMatchExprLookupStrategyFactoryIndexedFiltered(joinEvaluator, queryPlanDesc.getLookupStrategyFactory()), queryPlanDesc.getIndexDescs());
}
}
示例10: SubSelectStrategyFactoryIndexShare
import com.espertech.esper.epl.join.hint.IndexHint; //导入依赖的package包/类
public SubSelectStrategyFactoryIndexShare(final String statementName, int statementId, int subqueryNum, EventType[] outerEventTypesSelect, final NamedWindowProcessor optionalNamedWindowProcessor, TableMetadata optionalTableMetadata, boolean fullTableScan, IndexHint optionalIndexHint, SubordPropPlan joinedPropPlan, ExprEvaluator filterExprEval, AggregationServiceFactoryDesc aggregationServiceFactory, ExprEvaluator[] groupByKeys, TableService tableService, Annotation[] annotations, StatementStopService statementStopService, EngineImportService engineImportService) throws ExprValidationException {
this.optionalNamedWindowProcessor = optionalNamedWindowProcessor;
this.optionalTableMetadata = optionalTableMetadata;
this.filterExprEval = filterExprEval;
this.aggregationServiceFactory = aggregationServiceFactory;
this.groupByKeys = groupByKeys;
this.tableService = tableService;
boolean isLogging;
Logger log;
if (optionalTableMetadata != null) {
isLogging = optionalTableMetadata.isQueryPlanLogging();
log = TableServiceImpl.getQueryPlanLog();
queryPlan = SubordinateQueryPlanner.planSubquery(outerEventTypesSelect, joinedPropPlan, false, fullTableScan, optionalIndexHint, true, subqueryNum,
false, optionalTableMetadata.getEventTableIndexMetadataRepo(), optionalTableMetadata.getUniqueKeyProps(), true, statementName, statementId, annotations);
if (queryPlan != null) {
for (int i = 0; i < queryPlan.getIndexDescs().length; i++) {
optionalTableMetadata.addIndexReference(queryPlan.getIndexDescs()[i].getIndexName(), statementName);
}
}
} else {
isLogging = optionalNamedWindowProcessor.getRootView().isQueryPlanLogging();
log = NamedWindowRootView.getQueryPlanLog();
queryPlan = SubordinateQueryPlanner.planSubquery(outerEventTypesSelect, joinedPropPlan, false, fullTableScan, optionalIndexHint, true, subqueryNum,
optionalNamedWindowProcessor.isVirtualDataWindow(), optionalNamedWindowProcessor.getEventTableIndexMetadataRepo(), optionalNamedWindowProcessor.getOptionalUniqueKeyProps(), false, statementName, statementId, annotations);
if (queryPlan != null && queryPlan.getIndexDescs() != null) {
SubordinateQueryPlannerUtil.addIndexMetaAndRef(queryPlan.getIndexDescs(), optionalNamedWindowProcessor.getEventTableIndexMetadataRepo(), statementName);
statementStopService.addSubscriber(new StatementStopCallback() {
public void statementStopped() {
for (int i = 0; i < queryPlan.getIndexDescs().length; i++) {
boolean last = optionalNamedWindowProcessor.getEventTableIndexMetadataRepo().removeIndexReference(queryPlan.getIndexDescs()[i].getIndexMultiKey(), statementName);
if (last) {
optionalNamedWindowProcessor.getEventTableIndexMetadataRepo().removeIndex(queryPlan.getIndexDescs()[i].getIndexMultiKey());
optionalNamedWindowProcessor.removeAllInstanceIndexes(queryPlan.getIndexDescs()[i].getIndexMultiKey());
}
}
}
});
}
}
SubordinateQueryPlannerUtil.queryPlanLogOnSubq(isLogging, log, queryPlan, subqueryNum, annotations, engineImportService);
}
示例11: IndexHintPair
import com.espertech.esper.epl.join.hint.IndexHint; //导入依赖的package包/类
public IndexHintPair(IndexHint indexHint, ExcludePlanHint excludePlanHint) {
this.indexHint = indexHint;
this.excludePlanHint = excludePlanHint;
}
示例12: getIndexHint
import com.espertech.esper.epl.join.hint.IndexHint; //导入依赖的package包/类
public IndexHint getIndexHint() {
return indexHint;
}