public static Selector selector() { return new Selector(); }
public BasicSelector addGroupByList(List<Variable> list) { return (BasicSelector) super.addGroupByList(list); }
public BasicSelector addSelectionList(List<OutputAttribute> projectionList) { return (BasicSelector) super.addSelectionList(projectionList); }
Selector selector = new Selector(); attributeList.add((OutputAttribute) visit(output_attributeContext)); selector.addSelectionList(attributeList); selector.addGroupByList((List<Variable>) visit(ctx.group_by())); selector.having((Expression) visit(ctx.having())); selector.addOrderByList((List<OrderByAttribute>) visit(ctx.order_by())); selector.limit((Constant) visit(ctx.limit())); selector.offset((Constant) visit(ctx.offset()));
} else if (inputStream instanceof StateInputStream) { List<Variable> groupBy = selector.getGroupByList(); if (groupBy.size() > 0) { Map<String, List<Variable>> streamGroupBy = new HashMap<>(); outputStreams.put(outputStream.getId(), selector.getSelectionList());
field.setAccessible(true); Query query = (Query) field.get(callback); List<OutputAttribute> list = query.getSelector().getSelectionList(); for (OutputAttribute output : list) { outputFields.add(output.getRename());
/** * 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; }
private StreamPartition findStreamPartition(SingleInputStream inputStream, Selector selector) { // Window Spec List<Window> windows = new ArrayList<>(); for (StreamHandler streamHandler : inputStream.getStreamHandlers()) { if (streamHandler instanceof Window) { windows.add((Window) streamHandler); } } // Group By Spec List<Variable> groupBy = selector.getGroupByList(); if (windows.size() > 0 || groupBy.size() >= 0) { return generatePartition(inputStream.getStreamId(), windows, groupBy); } else { return null; } }
List<Variable> groupBy = selector.getGroupByList(); if (groupBy.size() >= 0) { Map<String, List<Variable>> streamGroupBy = new HashMap<>(); effectiveOutputStreams.put(outputStream.getId(), convertOutputStreamColumns(selector.getSelectionList())); } else { LOG.warn("Unhandled execution element: {}", executionElement.toString());
/** * Generates an AttributesSelectionConfig from the given Siddhi Selector * @param selector Siddhi Selector object * @return AttributesSelectionConfig object */ public AttributesSelectionConfig generateAttributesSelectionConfig(Selector selector) { List<SelectedAttribute> selectedAttributes = new ArrayList<>(); for (OutputAttribute outputAttribute : selector.getSelectionList()) { try { selectedAttributes.add(generateSelectedAttribute(outputAttribute)); } catch (DesignGenerationException e) { // Selector object has been successfully compiled by the Siddhi Compiler, but no query indexes // The OutputAttribute object was a result of 'select *' AllSelectionConfig allSelectionConfig = new AllSelectionConfig(); preserveAndBindCodeSegment(selector, allSelectionConfig); return new AllSelectionConfig(); } } UserDefinedSelectionConfig userDefinedSelectionConfig = new UserDefinedSelectionConfig(selectedAttributes); preserveAndBindCodeSegment(selector, userDefinedSelectionConfig); return new UserDefinedSelectionConfig(selectedAttributes); }
private StreamPartition findStreamPartition(SingleInputStream inputStream, Selector selector) { // Window Spec List<Window> windows = new ArrayList<>(); for (StreamHandler streamHandler : inputStream.getStreamHandlers()) { if (streamHandler instanceof Window) { windows.add((Window) streamHandler); } } // Group By Spec List<Variable> groupBy = selector.getGroupByList(); if (windows.size() > 0 || groupBy.size() > 0) { return generatePartition(inputStream.getStreamId(), windows, groupBy); } else { return null; } }
/** * 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); } }
static <E> List<E> randomSelectN(Collection<? extends E> coll, int n) { assert n <= coll.size(); return coll.stream() .filter(new Selector(coll.size(), n)) .collect(toList()); }
public BasicSelector addSelectionList(List<OutputAttribute> projectionList) { return (BasicSelector) super.addSelectionList(projectionList); }
public BasicSelector addGroupByList(List<Variable> list) { return (BasicSelector) super.addGroupByList(list); }
String outputStreamId = query.getOutputStream().getId(); loadOutputData(siddhiApp, siddhiAppRuntime, outputStreamId, siddhiAppString, siddhiAppElements); loadFunctionData(siddhiApp, query.getSelector().getSelectionList(), siddhiAppElements, siddhiAppString);
public static Selector selector() { return new Selector(); }
list_View.setMultiChoiceModeListener(new Selector());