public SiddhiApp defineTable(TableDefinition tableDefinition) { if (tableDefinition == null) { throw new SiddhiAppValidationException("Table Definition should not be null"); } else if (tableDefinition.getId() == null) { throw new SiddhiAppValidationException("Table Id should not be null for Table Definition", tableDefinition.getQueryContextStartIndex(), tableDefinition.getQueryContextEndIndex()); } checkDuplicateDefinition(tableDefinition); this.tableDefinitionMap.put(tableDefinition.getId(), tableDefinition); return this; }
public String getTableId() { return tableDefinition.getId(); } }
/** * Called to construct a operator to perform search operations */ @Override public Finder constructFinder(Expression expression, MatchingMetaStateHolder matchingMetaStateHolder, ExecutionPlanContext executionPlanContext, List<VariableExpressionExecutor> variableExpressionExecutors, Map<String, EventTable> eventTableMap) { return RDBMSOperatorParser.parse(dbHandler, expression, matchingMetaStateHolder, executionPlanContext, variableExpressionExecutors, eventTableMap, tableDefinition, cachedTable, tableDefinition.getId()); }
@Override public Operator constructOperator(Expression expression, MatchingMetaStateHolder matchingMetaStateHolder, ExecutionPlanContext executionPlanContext, List<VariableExpressionExecutor> variableExpressionExecutors, Map<String, EventTable> eventTableMap) { return HazelcastOperatorParser.constructOperator(eventHolder, expression, matchingMetaStateHolder, executionPlanContext, variableExpressionExecutors, eventTableMap, tableDefinition.getId()); } }
@Override public Finder cloneFinder(String key) { return new AnalyticsTableOperator(this.tenantId, this.tableName, this.myAttrs, this.expression, this.matchingMetaStateHolder, this.executionPlanContext, this.variableExpressionExecutors, this.eventTableMap, this.tableDefinition, this.tableDefinition.getId()); }
@Override public Finder constructFinder(Expression expression, MatchingMetaStateHolder matchingMetaStateHolder, ExecutionPlanContext executionPlanContext, List<VariableExpressionExecutor> variableExpressionExecutors, Map<String, EventTable> eventTableMap) { return HazelcastOperatorParser.constructOperator(eventHolder, expression, matchingMetaStateHolder, executionPlanContext, variableExpressionExecutors, eventTableMap, tableDefinition.getId()); }
/** * Called to construct a operator to perform delete and update operations */ @Override public Operator constructOperator(Expression expression, MatchingMetaStateHolder matchingMetaStateHolder, ExecutionPlanContext executionPlanContext, List<VariableExpressionExecutor> variableExpressionExecutors, Map<String, EventTable> eventTableMap) { return RDBMSOperatorParser.parse(dbHandler, expression, matchingMetaStateHolder, executionPlanContext, variableExpressionExecutors, eventTableMap, tableDefinition, cachedTable, tableDefinition.getId()); }
public SiddhiApp defineTable(TableDefinition tableDefinition) { if (tableDefinition == null) { throw new SiddhiAppValidationException("Table Definition should not be null"); } else if (tableDefinition.getId() == null) { throw new SiddhiAppValidationException("Table Id should not be null for Table Definition", tableDefinition.getQueryContextStartIndex(), tableDefinition.getQueryContextEndIndex()); } checkDuplicateDefinition(tableDefinition); this.tableDefinitionMap.put(tableDefinition.getId(), tableDefinition); return this; }
@Override public Operator constructOperator(Expression expression, MatchingMetaStateHolder matchingMetaStateHolder, ExecutionPlanContext executionPlanContext, List<VariableExpressionExecutor> variableExpressionExecutors, Map<String, EventTable> eventTableMap) { return new AnalyticsTableOperator(this.tenantId, this.tableName, this.tableDefinition.getAttributeList(), expression, matchingMetaStateHolder, executionPlanContext, variableExpressionExecutors, eventTableMap, this.tableDefinition, this.tableDefinition.getId()); }
@Override public Finder constructFinder(Expression expression, MatchingMetaStateHolder matchingMetaStateHolder, ExecutionPlanContext executionPlanContext, List<VariableExpressionExecutor> variableExpressionExecutors, Map<String, EventTable> eventTableMap) { return new AnalyticsTableOperator(this.tenantId, this.tableName, this.tableDefinition.getAttributeList(), expression, matchingMetaStateHolder, executionPlanContext, variableExpressionExecutors, eventTableMap, this.tableDefinition, tableDefinition.getId()); }
private void initMetaStateEvent() { this.outputAttrs = matchingMetaStateHolder.getMatchingStreamDefinition().getAttributeList(); for (MetaStreamEvent metaStreamEvent : matchingMetaStateHolder.getMetaStateEvent().getMetaStreamEvents()) { String referenceId = metaStreamEvent.getInputReferenceId(); AbstractDefinition abstractDefinition = metaStreamEvent.getLastInputDefinition(); if (!abstractDefinition.getId().trim().equals("")) { if (abstractDefinition instanceof TableDefinition) { this.eventTableRefs.add(abstractDefinition.getId()); if (referenceId != null) { this.eventTableRefs.add(referenceId); } } } } if (tableDefinition instanceof TableDefinition) { this.eventTableRefs.add(tableDefinition.getId()); } }
@Override protected void init(TableDefinition tableDefinition, ConfigReader configReader) { this.attributeNames = tableDefinition.getAttributeList().stream().map(Attribute::getName).collect(Collectors.toList()); Annotation storeAnnotation = AnnotationHelper .getAnnotation(ANNOTATION_STORE, tableDefinition.getAnnotations()); Annotation primaryKeys = AnnotationHelper .getAnnotation(ANNOTATION_PRIMARY_KEY, tableDefinition.getAnnotations()); Annotation indices = AnnotationHelper .getAnnotation(ANNOTATION_INDEX_BY, tableDefinition.getAnnotations()); this.initializeConnectionParameters(storeAnnotation, configReader); this.expectedIndexModels = new ArrayList<>(); IndexModel primaryKey = MongoTableUtils.extractPrimaryKey(primaryKeys, this.attributeNames); if (primaryKey != null) { this.expectedIndexModels.add(primaryKey); } this.expectedIndexModels.addAll(MongoTableUtils.extractIndexModels(indices, this.attributeNames)); String customCollectionName = storeAnnotation.getElement( MongoTableConstants.ANNOTATION_ELEMENT_COLLECTION_NAME); this.collectionName = MongoTableUtils.isEmpty(customCollectionName) ? tableDefinition.getId() : customCollectionName; this.initialCollectionTest = false; }
this.tableName = RDBMSTableUtils.isEmpty(tableName) ? tableDefinition.getId() : tableName;
executionPlanContext.getName() + '.' + tableDefinition.getId(); if (annotation.getElements().size() != 1) { throw new OperationNotSupportedException(SiddhiConstants.ANNOTATION_INDEX_BY + " annotation of table " + tableDefinition.getId() + " contains " + annotation.getElements().size() + " elements, Siddhi Hazelcast event table only supports indexing based on a single attribute");