org.wso2.siddhi.query.api.execution.query.Query类的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(11.9k)|赞(0)|评价(0)|浏览(156)

本文整理了Java中org.wso2.siddhi.query.api.execution.query.Query类的一些代码示例,展示了Query类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query类的具体详情如下:
包路径:org.wso2.siddhi.query.api.execution.query.Query
类名称:Query

Query介绍

[英]Siddhi Query
[中]Siddhi查询

代码示例

代码示例来源:origin: wso2/siddhi

public AnonymousInputStream(Query query) {
  super("Anonymous-" + UUID.randomUUID());
  if (query.getOutputStream() != null && !(query.getOutputStream() instanceof ReturnStream)) {
    throw new SiddhiAppValidationException("OutputStream of the query is not on type Return!",
        query.getOutputStream().getQueryContextStartIndex(),
        query.getOutputStream().getQueryContextEndIndex());
  }
  this.query = query;
}

代码示例来源:origin: wso2/siddhi

public Partition addQuery(Query query) {
  if (query == null) {
    throw new SiddhiAppValidationException("Query should not be null");
  }
  String name = null;
  Element element = AnnotationHelper.getAnnotationElement(SiddhiConstants.ANNOTATION_INFO, SiddhiConstants
      .ANNOTATION_ELEMENT_NAME, query.getAnnotations());
  if (element != null) {
    name = element.getValue();
  }
  if (name != null && queryNameList.contains(name)) {
    throw new SiddhiAppValidationException("Cannot add Query as another Execution Element already uses " +
        "its name=" + name + " within the same Partition",
        element.getQueryContextStartIndex(), element.getQueryContextEndIndex());
  }
  queryNameList.add(name);
  this.queryList.add(query);
  return this;
}

代码示例来源:origin: stackoverflow.com

protected static boolean exists(String table, long id) throws Exception
{
  Db db = Util.getDb();
  Query q = db.query();
  q.select( idField ).whereLong(idField, id).limit(1).get(table);

  return q.hasResults();
}

代码示例来源:origin: haoch/flink-siddhi

InputStream inputStream = ((Query) executionElement).getInputStream();
Selector selector = ((Query) executionElement).getSelector();
Map<String, SingleInputStream> queryLevelAliasToStreamMapping = new HashMap<>();
OutputStream outputStream = ((Query) executionElement).getOutputStream();
outputStreams.put(outputStream.getId(), selector.getSelectionList());

代码示例来源:origin: org.wso2.carbon.analytics/org.wso2.carbon.siddhi.editor.core

/**
 * Generates a QueryConfig object with the given Siddhi Query object
 * @param query                 Siddhi Query object
 * @return                      QueryConfig object
 */
public QueryConfig generateQueryConfig(Query query)
    throws DesignGenerationException {
  QueryConfig queryConfig = new QueryConfig();
  queryConfig.setQueryInput(generateInput(query.getInputStream()));
  Selector selector = query.getSelector();
  queryConfig.setSelect(generateSelect(selector));
  queryConfig.setGroupBy(generateGroupBy(selector.getGroupByList()));
  queryConfig.setOrderBy(generateOrderBy(selector.getOrderByList()));
  queryConfig.setHaving(generateHaving(selector.getHavingExpression()));
  queryConfig.setLimit(generateLimit(selector.getLimit()));
  queryConfig.setQueryOutput(generateOutput(query.getOutputStream()));
  queryConfig.setOutputRateLimit(generateOutputRateLimit(query.getOutputRate()));
  queryConfig.setAnnotationList(generateAnnotationList(query.getAnnotations()));
  queryConfig.setQueryName(generateQueryName(query.getAnnotations()));
  preserveAndBindCodeSegment(query, queryConfig);
  return queryConfig;
}

代码示例来源:origin: org.wso2.carbon.event-processing/org.wso2.carbon.event.processor.core

public void addExecutionElement(ExecutionElementInfoHolder infoHolder) throws StormQueryConstructionException {
  if (infoHolder.getExecutionElement() instanceof Query) {
    inputDefinitionIds.addAll(((Query) infoHolder.getExecutionElement()).getInputStream().getUniqueStreamIds());
    outputDefinitionIds.add(((Query) infoHolder.getExecutionElement()).getOutputStream().getId());
  } else {
    Partition partition = (Partition) infoHolder.getExecutionElement();
    for (Query query : partition.getQueryList()) {
      for (String id : query.getInputStream().getUniqueStreamIds()) {
        if (!id.contains("#")) {  //if not an inner stream
          inputDefinitionIds.add(id);
      outputDefinitionIds.add(query.getOutputStream().getId());

代码示例来源:origin: org.wso2.carbon.analytics/org.wso2.carbon.sp.jobmanager.core

if (executionElement instanceof Query) {
  queryContextStartIndex = ((Query) executionElement).getQueryContextStartIndex();
  queryContextEndIndex = ((Query) executionElement).getQueryContextEndIndex();
  siddhiQueryGroup.addQuery(removeMetaInfoQuery(executionElement, ExceptionUtil
      .getContext(queryContextStartIndex, queryContextEndIndex, userDefinedSiddhiApp)));
  siddhiQueryGroup.addInputStreams(getInputStreamHolderInfo((Query) executionElement,
      siddhiQueryGroup, true));
  String outputStreamId = ((Query) executionElement).getOutputStream().getId();
  siddhiQueryGroup.addOutputStream(outputStreamId, getOutputStreamHolderInfo(outputStreamId, parallelism,
          queryGroupName));
        query.getAnnotations()) != null) {
      throw new SiddhiAppValidationException("Unsupported:@dist annotation inside partition queries");
    String outputStreamId = query.getOutputStream().getId();
    siddhiQueryGroup.addOutputStream(outputStreamId, getOutputStreamHolderInfo(outputStreamId,
        parallelism, queryGroupName));

代码示例来源:origin: org.wso2.carbon.event-processing/org.wso2.carbon.event.processor.core

String queryString) throws StormQueryConstructionException {
if (parallel != -1) {    //if not a partition
  if (!(query.getInputStream() instanceof BasicSingleInputStream)) {      //if window/join/pattern query
    if (parallel > 1) {
      throw new StormQueryConstructionException("Error in deploying query: " + queryString + " Parallelism has " +
  for (Annotation annotation : query.getAnnotations()) {
    if (annotation.getName().equals(EventProcessorConstants.DIST)) {
      throw new StormQueryConstructionException("Error in deploying query: " + queryString + ". Query level" +

代码示例来源:origin: org.wso2.carbon.analytics/org.wso2.carbon.sp.jobmanager.core

List<String> streamIdsList;
if (executionElement instanceof Query) {
  streamIdsList =  ((Query) executionElement).getInputStream().getUniqueStreamIds();
  for (String streamId : streamIdsList) {
    if (inMemoryAggregationIds.contains(streamId)) {
    streamIdsList =  ((Query) innerPartitionElement).getInputStream().getUniqueStreamIds();
    for (String streamId : streamIdsList) {
      if (inMemoryAggregationIds.contains(streamId)) {

代码示例来源:origin: org.wso2.siddhi/siddhi-query-compiler

Query query = Query.query().from((InputStream) visit(ctx.query_input()));
  query.select((Selector) visit(ctx.query_section()));
  query.output((OutputRate) visit(ctx.output_rate()));
  query.annotation((Annotation) visit(annotationContext));
  query.outStream((OutputStream) visit(ctx.query_output()));

代码示例来源:origin: org.apache.eagle/eagle-policy-base

field.setAccessible(true);
Query query = (Query) field.get(callback);
List<OutputAttribute> list = query.getSelector().getSelectionList();
for (OutputAttribute output : list) {
  outputFields.add(output.getRename());

代码示例来源:origin: org.wso2.carbon.analytics/org.wso2.carbon.stream.processor.core

/**
 * Load all the elements of query
 */
private void loadQueryExecutionElements(SiddhiApp siddhiApp, SiddhiAppRuntime siddhiAppRuntime, ExecutionElement
    executionElement, String siddhiAppString, List<SiddhiAppElements> listOfSiddhiAppElements) {
  for (String inputStreamId : (((Query) executionElement).getInputStream()
      .getUniqueStreamIds())) {
    SiddhiAppElements siddhiAppElements = new SiddhiAppElements();
    siddhiAppElements.setInputStreamId(inputStreamId);
    loadInputData(siddhiApp, siddhiAppRuntime, inputStreamId, siddhiAppString, siddhiAppElements);
    String outPutStreamId = ((Query) executionElement)
        .getOutputStream().getId();
    siddhiAppElements.setOutputStreamId(outPutStreamId);
    loadOutputData(siddhiApp, siddhiAppRuntime, outPutStreamId, siddhiAppString, siddhiAppElements);
    loadFunctionData(siddhiApp, ((Query) executionElement).getSelector
        ().getSelectionList(), siddhiAppElements, siddhiAppString);
    loadQueryName(executionElement.getAnnotations(), siddhiAppElements);
    Query query = (Query) executionElement;
    siddhiAppElements.setQuery(getDefinition(query, siddhiAppString));
    listOfSiddhiAppElements.add(siddhiAppElements);
  }
}

代码示例来源:origin: org.wso2.carbon.analytics/org.wso2.carbon.sp.jobmanager.core

if (inputStreamDataHolder.isInnerGroupStream()) {
  for (ExecutionElement element : siddhiApp.getExecutionElementList()) {
    if (element instanceof Partition && ((Partition) element).getQueryList().get(0).getInputStream()
        .getAllStreamIds().contains(inputStreamDataHolder.getStreamName()) &&
        siddhiQueryGroup.getParallelism() > SiddhiTopologyCreatorConstants.DEFAULT_PARALLEL) {

代码示例来源:origin: org.wso2.siddhi/siddhi-query-compiler

activeStreams = new HashSet<String>();
Query query = Query.query().from((InputStream) visit(ctx.query_input()));
  query.select((Selector) visit(ctx.query_section()));
  query.output((OutputRate) visit(ctx.output_rate()));
  query.outStream(new ReturnStream((OutputStream.OutputEventType) visit(ctx.output_event_type())));
} else {
  query.outStream(new ReturnStream());

代码示例来源:origin: org.wso2.carbon.analytics/org.wso2.carbon.stream.processor.core

List<Query> partitionStream = ((Partition) executionElement).getQueryList();
for (Query query : partitionStream) {
  for (String inputStreamId : query.getInputStream().getUniqueStreamIds()) {
    SiddhiAppElements siddhiAppElements = new SiddhiAppElements();
    siddhiAppElements.setOutputStreamId(query.getOutputStream().getId());
    siddhiAppElements.setPartitionQuery(getDefinition(query, siddhiAppString));
    loadQueryName(executionElement.getAnnotations(), siddhiAppElements);
    loadInputData(siddhiApp, siddhiAppRuntime, inputStreamId, siddhiAppString, siddhiAppElements);
    String outputStreamId = query.getOutputStream().getId();
    loadOutputData(siddhiApp, siddhiAppRuntime, outputStreamId, siddhiAppString, siddhiAppElements);
    loadFunctionData(siddhiApp, query.getSelector().getSelectionList(), siddhiAppElements, siddhiAppString);

代码示例来源:origin: org.wso2.carbon.analytics/org.wso2.carbon.sp.jobmanager.core

String execGroupName = siddhiQueryGroup.getName();
StreamDataHolder streamDataHolder;
InputStream inputStream = (executionElement).getInputStream();
Map<String, InputStreamDataHolder> inputStreamDataHolderMap = new HashMap<>();

代码示例来源:origin: org.wso2.siddhi/siddhi-query-api

public AnonymousInputStream(Query query) {
  super("Anonymous-" + UUID.randomUUID());
  if (query.getOutputStream() != null && !(query.getOutputStream() instanceof ReturnStream)) {
    throw new SiddhiAppValidationException("OutputStream of the query is not on type Return!",
        query.getOutputStream().getQueryContextStartIndex(),
        query.getOutputStream().getQueryContextEndIndex());
  }
  this.query = query;
}

代码示例来源:origin: wso2/siddhi

public SiddhiApp addQuery(Query query) {
  if (query == null) {
    throw new SiddhiAppValidationException("Query should not be null");
  }
  String name = null;
  Element element = AnnotationHelper.getAnnotationElement(SiddhiConstants.ANNOTATION_INFO, SiddhiConstants
      .ANNOTATION_ELEMENT_NAME, query.getAnnotations());
  if (element != null) {
    name = element.getValue();
  }
  if (name != null && executionElementNameList.contains(name)) {
    throw new SiddhiAppValidationException(
        "Cannot add Query as another Execution Element already uses " + "its name=" + name,
        element.getQueryContextStartIndex(), element.getQueryContextEndIndex());
  }
  executionElementNameList.add(name);
  this.executionElementList.add(query);
  return this;
}

代码示例来源:origin: apache/eagle

InputStream inputStream = ((Query) executionElement).getInputStream();
  Selector selector = ((Query) executionElement).getSelector();
  Map<String, SingleInputStream> queryLevelAliasToStreamMapping = new HashMap<>();
  OutputStream outputStream = ((Query) executionElement).getOutputStream();
  effectiveOutputStreams.put(outputStream.getId(), convertOutputStreamColumns(selector.getSelectionList()));
} else {

代码示例来源:origin: org.wso2.siddhi/siddhi-query-api

public Partition addQuery(Query query) {
  if (query == null) {
    throw new SiddhiAppValidationException("Query should not be null");
  }
  String name = null;
  Element element = AnnotationHelper.getAnnotationElement(SiddhiConstants.ANNOTATION_INFO, SiddhiConstants
      .ANNOTATION_ELEMENT_NAME, query.getAnnotations());
  if (element != null) {
    name = element.getValue();
  }
  if (name != null && queryNameList.contains(name)) {
    throw new SiddhiAppValidationException("Cannot add Query as another Execution Element already uses " +
        "its name=" + name + " within the same Partition",
        element.getQueryContextStartIndex(), element.getQueryContextEndIndex());
  }
  queryNameList.add(name);
  this.queryList.add(query);
  return this;
}

相关文章