本文整理汇总了Java中com.espertech.esper.epl.declexpr.ExprDeclaredNode类的典型用法代码示例。如果您正苦于以下问题:Java ExprDeclaredNode类的具体用法?Java ExprDeclaredNode怎么用?Java ExprDeclaredNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ExprDeclaredNode类属于com.espertech.esper.epl.declexpr包,在下文中一共展示了ExprDeclaredNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import com.espertech.esper.epl.declexpr.ExprDeclaredNode; //导入依赖的package包/类
public void visit(ExprNode exprNode) {
if (exprNode instanceof ExprDotNode) {
chainedExpressionsDot.add((ExprDotNode) exprNode);
}
if (exprNode instanceof ExprDeclaredNode) {
declaredExpressions.add((ExprDeclaredNode) exprNode);
}
if (!(exprNode instanceof ExprSubselectNode)) {
return;
}
ExprSubselectNode subselectNode = (ExprSubselectNode) exprNode;
subselects.add(subselectNode);
}
示例2: getDeclaredExpressionCallHierarchy
import com.espertech.esper.epl.declexpr.ExprDeclaredNode; //导入依赖的package包/类
public static Map<ExprDeclaredNode, List<ExprDeclaredNode>> getDeclaredExpressionCallHierarchy(ExprDeclaredNode[] declaredExpressions) {
ExprNodeSubselectDeclaredDotVisitor visitor = new ExprNodeSubselectDeclaredDotVisitor();
Map<ExprDeclaredNode, List<ExprDeclaredNode>> calledToCallerMap = new HashMap<ExprDeclaredNode, List<ExprDeclaredNode>>();
for (ExprDeclaredNode node : declaredExpressions) {
visitor.reset();
node.accept(visitor);
for (ExprDeclaredNode called : visitor.getDeclaredExpressions()) {
if (called == node) {
continue;
}
List<ExprDeclaredNode> callers = calledToCallerMap.get(called);
if (callers == null) {
callers = new ArrayList<ExprDeclaredNode>(2);
calledToCallerMap.put(called, callers);
}
callers.add(node);
}
if (!calledToCallerMap.containsKey(node)) {
calledToCallerMap.put(node, Collections.<ExprDeclaredNode>emptyList());
}
}
return calledToCallerMap;
}
示例3: determineTableAccessNodes
import com.espertech.esper.epl.declexpr.ExprDeclaredNode; //导入依赖的package包/类
private Set<ExprTableAccessNode> determineTableAccessNodes(Set<ExprTableAccessNode> statementDirectTableAccess, ExprNodeSubselectDeclaredDotVisitor visitor) {
Set<ExprTableAccessNode> tableAccessNodes = new HashSet<ExprTableAccessNode>();
if (statementDirectTableAccess != null) {
tableAccessNodes.addAll(statementDirectTableAccess);
}
// include all declared expression usages
ExprNodeTableAccessVisitor tableAccessVisitor = new ExprNodeTableAccessVisitor(tableAccessNodes);
for (ExprDeclaredNode declared : visitor.getDeclaredExpressions()) {
declared.getBody().accept(tableAccessVisitor);
}
// include all subqueries (and their declared expressions)
// This is nested as declared expressions can have more subqueries, however all subqueries are in this list.
for (ExprSubselectNode subselectNode : visitor.getSubselects()) {
if (subselectNode.getStatementSpecRaw().getTableExpressions() != null) {
tableAccessNodes.addAll(subselectNode.getStatementSpecRaw().getTableExpressions());
}
}
return tableAccessNodes;
}
示例4: visit
import com.espertech.esper.epl.declexpr.ExprDeclaredNode; //导入依赖的package包/类
public void visit(ExprNode exprNode, ExprNode parentExprNode) {
if (exprNode instanceof ExprDotNode)
{
chainedExpressionsDot.add((ExprDotNode) exprNode);
}
if (exprNode instanceof ExprDeclaredNode)
{
declaredExpressions.add((ExprDeclaredNode) exprNode);
}
if (!(exprNode instanceof ExprSubselectNode))
{
return;
}
ExprSubselectNode subselectNode = (ExprSubselectNode) exprNode;
subselects.add(subselectNode);
}
示例5: findColumnNameForAggregation
import com.espertech.esper.epl.declexpr.ExprDeclaredNode; //导入依赖的package包/类
private static String findColumnNameForAggregation(Map<ExprNode, String> selectClauseNamedNodes, List<ExprDeclaredNode> declaredExpressions, ExprAggregateNode aggregationNode) {
if (selectClauseNamedNodes.containsKey(aggregationNode)) {
return selectClauseNamedNodes.get(aggregationNode);
}
for (ExprDeclaredNode node : declaredExpressions) {
if (node.getBody() == aggregationNode) {
return node.getPrototype().getName();
}
}
return null;
}
示例6: validateIndexNamedParameter
import com.espertech.esper.epl.declexpr.ExprDeclaredNode; //导入依赖的package包/类
private void validateIndexNamedParameter(ExprValidationContext validationContext) throws ExprValidationException {
if (indexNamedParameter.length != 1 || !(indexNamedParameter[0] instanceof ExprDeclaredNode)) {
throw getIndexNameMessage("requires an expression name");
}
ExprDeclaredNode node = (ExprDeclaredNode) indexNamedParameter[0];
if (!(node.getBody() instanceof ExprDotNode)) {
throw getIndexNameMessage("requires an index expression");
}
ExprDotNode dotNode = (ExprDotNode) node.getBody();
if (dotNode.getChainSpec().size() > 1) {
throw getIndexNameMessage("invalid chained index expression");
}
List<ExprNode> params = dotNode.getChainSpec().get(0).getParameters();
String indexTypeName = dotNode.getChainSpec().get(0).getName();
optionalIndexName = node.getPrototype().getName();
AdvancedIndexFactoryProvider provider;
try {
provider = validationContext.getEngineImportService().resolveAdvancedIndexProvider(indexTypeName);
} catch (EngineImportException e) {
throw new ExprValidationException(e.getMessage(), e);
}
if (!indexTypeName.toLowerCase(Locale.ENGLISH).equals(indexTypeName())) {
throw new ExprValidationException("Invalid index type '" + indexTypeName + "', expected '" + indexTypeName() + "'");
}
optionalIndexConfig = provider.validateConfigureFilterIndex(optionalIndexName, indexTypeName, ExprNodeUtilityCore.toArray(params), validationContext);
}
示例7: recursiveAggregateHandleSpecial
import com.espertech.esper.epl.declexpr.ExprDeclaredNode; //导入依赖的package包/类
private static void recursiveAggregateHandleSpecial(ExprNode topNode, Map<Integer, List<ExprAggregateNode>> aggregateExprPerLevel, int level) {
if (topNode instanceof ExprNodeInnerNodeProvider) {
ExprNodeInnerNodeProvider parameterized = (ExprNodeInnerNodeProvider) topNode;
List<ExprNode> additionalNodes = parameterized.getAdditionalNodes();
for (ExprNode additionalNode : additionalNodes) {
recursiveAggregateEnter(additionalNode, aggregateExprPerLevel, level);
}
}
if (topNode instanceof ExprDeclaredNode) {
ExprDeclaredNode declared = (ExprDeclaredNode) topNode;
recursiveAggregateEnter(declared.getBody(), aggregateExprPerLevel, level);
}
}
示例8: planSubSelect
import com.espertech.esper.epl.declexpr.ExprDeclaredNode; //导入依赖的package包/类
protected static SubSelectStrategyCollection planSubSelect(EPServicesContext services,
StatementContext statementContext,
boolean queryPlanLogging,
SubSelectActivationCollection subSelectStreamDesc,
String[] outerStreamNames,
EventType[] outerEventTypesSelect,
String[] outerEventTypeNamees,
ExprDeclaredNode[] declaredExpressions,
ContextPropertyRegistry contextPropertyRegistry)
throws ExprValidationException, ViewProcessingException {
int subqueryNum = -1;
SubSelectStrategyCollection collection = new SubSelectStrategyCollection();
Map<ExprDeclaredNode, List<ExprDeclaredNode>> declaredExpressionCallHierarchy = null;
if (declaredExpressions.length > 0) {
declaredExpressionCallHierarchy = ExprNodeUtilityRich.getDeclaredExpressionCallHierarchy(declaredExpressions);
}
for (Map.Entry<ExprSubselectNode, SubSelectActivationHolder> entry : subSelectStreamDesc.getSubqueries().entrySet()) {
subqueryNum++;
ExprSubselectNode subselect = entry.getKey();
SubSelectActivationHolder subSelectActivation = entry.getValue();
try {
SubSelectStrategyFactoryDesc factoryDesc = planSubSelectInternal(subqueryNum, subselect, subSelectActivation,
services, statementContext, queryPlanLogging, subSelectStreamDesc,
outerStreamNames, outerEventTypesSelect, outerEventTypeNamees,
declaredExpressions, contextPropertyRegistry, declaredExpressionCallHierarchy);
collection.add(subselect, factoryDesc);
} catch (Exception ex) {
throw new ExprValidationException("Failed to plan " + getSubqueryInfoText(subqueryNum, subselect) + ": " + ex.getMessage(), ex);
}
}
return collection;
}
示例9: StatementSpecCompiled
import com.espertech.esper.epl.declexpr.ExprDeclaredNode; //导入依赖的package包/类
/**
* Ctor.
*/
public StatementSpecCompiled()
{
onTriggerDesc = null;
createWindowDesc = null;
createIndexDesc = null;
createVariableDesc = null;
createSchemaDesc = null;
insertIntoDesc = null;
selectStreamDirEnum = SelectClauseStreamSelectorEnum.RSTREAM_ISTREAM_BOTH;
selectClauseSpec = new SelectClauseSpecCompiled(false);
streamSpecs = new ArrayList<StreamSpecCompiled>();
outerJoinDescList = new ArrayList<OuterJoinDesc>();
filterExprRootNode = null;
groupByExpressions = new ArrayList<ExprNode>();
havingExprRootNode = null;
outputLimitSpec = null;
orderByList = new ArrayList<OrderByItem>();
subSelectExpressions = new ArrayList<ExprSubselectNode>();
declaredExpressions = new ArrayList<ExprDeclaredNode>();
variableReferences = new HashSet<String>();
rowLimitSpec = null;
eventTypeReferences = new HashSet<String>();
annotations = new Annotation[0];
updateSpec = null;
matchRecognizeSpec = null;
forClauseSpec = null;
sqlParameters = null;
contextDesc = null;
optionalContextName = null;
createGraphDesc = null;
createExpressionDesc = null;
}
示例10: ExprNodeSubselectDeclaredDotVisitor
import com.espertech.esper.epl.declexpr.ExprDeclaredNode; //导入依赖的package包/类
/**
* Ctor.
*/
public ExprNodeSubselectDeclaredDotVisitor()
{
subselects = new ArrayList<ExprSubselectNode>(1);
chainedExpressionsDot = new ArrayList<ExprDotNode>(1);
declaredExpressions = new ArrayList<ExprDeclaredNode>(1);
}
示例11: attach
import com.espertech.esper.epl.declexpr.ExprDeclaredNode; //导入依赖的package包/类
public void attach(EventType parentEventType, StatementContext statementContext, ViewFactory optionalParentFactory, List<ViewFactory> parentViewFactories) throws ViewParameterException {
this.eventType = parentEventType;
// define built-in fields
Map<String, Object> builtinTypeDef = ExpressionViewOAFieldEnum.asMapOfTypes(eventType);
builtinMapType = statementContext.getEventAdapterService().createAnonymousObjectArrayType(statementContext.getStatementId() + "_exprview", builtinTypeDef);
StreamTypeService streamTypeService = new StreamTypeServiceImpl(new EventType[]{eventType, builtinMapType}, new String[2], new boolean[2], statementContext.getEngineURI(), false, false);
// validate expression
expiryExpression = ViewFactorySupport.validateExpr(getViewName(), statementContext, expiryExpression, streamTypeService, 0);
ExprNodeSummaryVisitor summaryVisitor = new ExprNodeSummaryVisitor();
expiryExpression.accept(summaryVisitor);
if (summaryVisitor.isHasSubselect() || summaryVisitor.isHasStreamSelect() || summaryVisitor.isHasPreviousPrior()) {
throw new ViewParameterException("Invalid expiry expression: Sub-select, previous or prior functions are not supported in this context");
}
expiryExpressionEvaluator = ExprNodeCompiler.allocateEvaluator(expiryExpression.getForge(), statementContext.getEngineImportService(), ExpressionViewFactoryBase.class, false, statementContext.getStatementName());
Class returnType = expiryExpression.getForge().getEvaluationType();
if (JavaClassHelper.getBoxedType(returnType) != Boolean.class) {
throw new ViewParameterException("Invalid return value for expiry expression, expected a boolean return value but received " + JavaClassHelper.getParameterAsString(returnType));
}
// determine variables used, if any
ExprNodeVariableVisitor visitor = new ExprNodeVariableVisitor(statementContext.getVariableService());
expiryExpression.accept(visitor);
variableNames = visitor.getVariableNames();
// determine aggregation nodes, if any
List<ExprAggregateNode> aggregateNodes = new ArrayList<ExprAggregateNode>();
ExprAggregateNodeUtil.getAggregatesBottomUp(expiryExpression, aggregateNodes);
if (!aggregateNodes.isEmpty()) {
try {
AggregationServiceForgeDesc forge = AggregationServiceFactoryFactory.getService(Collections.<ExprAggregateNode>emptyList(), Collections.<ExprNode, String>emptyMap(), Collections.<ExprDeclaredNode>emptyList(), null, aggregateNodes, Collections.<ExprAggregateNode>emptyList(), Collections.<ExprAggregateNodeGroupKey>emptyList(), false, statementContext.getAnnotations(), statementContext.getVariableService(), false, false, null, null, statementContext.getAggregationServiceFactoryService(), streamTypeService.getEventTypes(), null, statementContext.getContextName(), null, null, false, false, false, statementContext.getEngineImportService(), statementContext.getStatementName(), statementContext.getTimeAbacus());
AggregationServiceFactory factory = AggregationServiceFactoryCompiler.allocate(forge.getAggregationServiceFactoryForge(), statementContext, false);
aggregationServiceFactoryDesc = new AggregationServiceFactoryDesc(factory, forge.getExpressions(), forge.getGroupKeyExpressions());
} catch (ExprValidationException ex) {
throw new ViewParameterException(ex.getMessage(), ex);
}
}
}
示例12: matchBindingsAssignColumnNumbers
import com.espertech.esper.epl.declexpr.ExprDeclaredNode; //导入依赖的package包/类
private static BindingMatchResult matchBindingsAssignColumnNumbers(IntoTableSpec bindings,
TableMetadata metadata,
List<AggregationServiceAggExpressionDesc> aggregations,
Map<ExprNode, String> selectClauseNamedNodes,
List<ExprForge[]> methodAggForgesList,
List<ExprDeclaredNode> declaredExpressions,
EngineImportService engineImportService,
String statementName,
boolean isFireAndForget)
throws ExprValidationException {
Map<AggregationServiceAggExpressionDesc, TableMetadataColumnAggregation> methodAggs = new LinkedHashMap<AggregationServiceAggExpressionDesc, TableMetadataColumnAggregation>();
Map<AggregationServiceAggExpressionDesc, TableMetadataColumnAggregation> accessAggs = new LinkedHashMap<AggregationServiceAggExpressionDesc, TableMetadataColumnAggregation>();
for (AggregationServiceAggExpressionDesc aggDesc : aggregations) {
// determine assigned name
String columnName = findColumnNameForAggregation(selectClauseNamedNodes, declaredExpressions, aggDesc.getAggregationNode());
if (columnName == null) {
throw new ExprValidationException("Failed to find an expression among the select-clause expressions for expression '" + ExprNodeUtilityCore.toExpressionStringMinPrecedenceSafe(aggDesc.getAggregationNode()) + "'");
}
// determine binding metadata
TableMetadataColumnAggregation columnMetadata = (TableMetadataColumnAggregation) metadata.getTableColumns().get(columnName);
if (columnMetadata == null) {
throw new ExprValidationException("Failed to find name '" + columnName + "' among the columns for table '" + bindings.getName() + "'");
}
// validate compatible
validateIntoTableCompatible(bindings.getName(), columnName, columnMetadata, aggDesc);
if (!columnMetadata.getFactory().isAccessAggregation()) {
methodAggs.put(aggDesc, columnMetadata);
} else {
accessAggs.put(aggDesc, columnMetadata);
}
}
// handle method-aggs
TableColumnMethodPair[] methodPairs = new TableColumnMethodPair[methodAggForgesList.size()];
int methodIndex = -1;
for (Map.Entry<AggregationServiceAggExpressionDesc, TableMetadataColumnAggregation> methodEntry : methodAggs.entrySet()) {
methodIndex++;
int targetIndex = methodEntry.getValue().getMethodOffset();
ExprForge[] forges = methodAggForgesList.get(methodIndex);
ExprEvaluator evaluator = ExprNodeUtilityRich.getEvaluatorMayCompileWMultiValue(forges, engineImportService, AggregationServiceFactoryFactory.class, isFireAndForget, statementName);
methodPairs[methodIndex] = new TableColumnMethodPair(evaluator, forges, targetIndex, methodEntry.getKey().getAggregationNode());
methodEntry.getKey().setColumnNum(targetIndex);
}
// handle access-aggs
Map<Integer, ExprNode> accessSlots = new LinkedHashMap<Integer, ExprNode>();
List<AggregationAccessorSlotPairForge> accessReadPairs = new ArrayList<>();
int accessIndex = -1;
List<AggregationAgentForge> agents = new ArrayList<>();
for (Map.Entry<AggregationServiceAggExpressionDesc, TableMetadataColumnAggregation> accessEntry : accessAggs.entrySet()) {
accessIndex++;
int slot = accessEntry.getValue().getAccessAccessorSlotPair().getSlot();
AggregationMethodFactory aggregationMethodFactory = accessEntry.getKey().getFactory();
AggregationAccessorForge accessorForge = aggregationMethodFactory.getAccessorForge();
accessSlots.put(slot, accessEntry.getKey().getAggregationNode());
accessReadPairs.add(new AggregationAccessorSlotPairForge(slot, accessorForge));
accessEntry.getKey().setColumnNum(metadata.getNumberMethodAggregations() + accessIndex);
agents.add(aggregationMethodFactory.getAggregationStateAgent(engineImportService, statementName));
}
AggregationAgentForge[] agentArr = agents.toArray(new AggregationAgentForge[agents.size()]);
AggregationAccessorSlotPairForge[] accessReads = accessReadPairs.toArray(new AggregationAccessorSlotPairForge[accessReadPairs.size()]);
int[] targetStates = new int[accessSlots.size()];
ExprNode[] accessStateExpr = new ExprNode[accessSlots.size()];
int count = 0;
for (Map.Entry<Integer, ExprNode> entry : accessSlots.entrySet()) {
targetStates[count] = entry.getKey();
accessStateExpr[count] = entry.getValue();
count++;
}
return new BindingMatchResult(methodPairs, accessReads, targetStates, accessStateExpr, agentArr);
}
示例13: ExprNodeDeclaredVisitor
import com.espertech.esper.epl.declexpr.ExprDeclaredNode; //导入依赖的package包/类
/**
* Ctor.
*/
public ExprNodeDeclaredVisitor() {
declaredExpressions = new ArrayList<ExprDeclaredNode>(1);
}
示例14: getDeclaredExpressions
import com.espertech.esper.epl.declexpr.ExprDeclaredNode; //导入依赖的package包/类
public List<ExprDeclaredNode> getDeclaredExpressions() {
return declaredExpressions;
}
示例15: visit
import com.espertech.esper.epl.declexpr.ExprDeclaredNode; //导入依赖的package包/类
public void visit(ExprNode exprNode) {
if (exprNode instanceof ExprDeclaredNode) {
declaredExpressions.add((ExprDeclaredNode) exprNode);
}
}