@Override public int compare(WithQueryCommand o1, WithQueryCommand o2) { return order.get(o1.getGroupSymbol()).compareTo(order.get(o2.getGroupSymbol())); } });
@Override public int compare(WithQueryCommand o1, WithQueryCommand o2) { return order.get(o1.getGroupSymbol()).compareTo(order.get(o2.getGroupSymbol())); } });
@Override public int compare(WithQueryCommand o1, WithQueryCommand o2) { return order.get(o1.getGroupSymbol()).compareTo(order.get(o2.getGroupSymbol())); } });
public String toString() { StringBuilder sb = new StringBuilder(); if (this.with != null) { sb.append(SQLConstants.Reserved.WITH); for (WithQueryCommand withCommand : this.with) { sb.append("\n"); //$NON-NLS-1$ sb.append(withCommand.getGroupSymbol()); if (withCommand.isRecursive()) { sb.append(" anchor\n").append(((SetQuery)withCommand.getCommand()).getLeftQuery().getProcessorPlan()); //$NON-NLS-1$ sb.append("recursive\n").append(((SetQuery)withCommand.getCommand()).getRightQuery().getProcessorPlan()); //$NON-NLS-1$ } else { sb.append("\n"); //$NON-NLS-1$ sb.append(withCommand.getCommand().getProcessorPlan()); } } sb.append("body\n"); //$NON-NLS-1$ } sb.append(this.root.toString()); return sb.toString(); }
public String toString() { StringBuilder sb = new StringBuilder(); if (this.with != null) { sb.append(SQLConstants.Reserved.WITH); for (WithQueryCommand withCommand : this.with) { sb.append("\n"); //$NON-NLS-1$ sb.append(withCommand.getGroupSymbol()); if (withCommand.isRecursive()) { sb.append(" anchor\n").append(((SetQuery)withCommand.getCommand()).getLeftQuery().getProcessorPlan()); //$NON-NLS-1$ sb.append("recursive\n").append(((SetQuery)withCommand.getCommand()).getRightQuery().getProcessorPlan()); //$NON-NLS-1$ } else { sb.append("\n"); //$NON-NLS-1$ sb.append(withCommand.getCommand().getProcessorPlan()); } } sb.append("body\n"); //$NON-NLS-1$ } sb.append(this.root.toString()); return sb.toString(); }
public String toString() { StringBuilder sb = new StringBuilder(); if (this.with != null) { sb.append(SQLConstants.Reserved.WITH); for (WithQueryCommand withCommand : this.with) { sb.append("\n"); //$NON-NLS-1$ sb.append(withCommand.getGroupSymbol()); if (withCommand.isRecursive()) { sb.append(" anchor\n").append(((SetQuery)withCommand.getCommand()).getLeftQuery().getProcessorPlan()); //$NON-NLS-1$ sb.append("recursive\n").append(((SetQuery)withCommand.getCommand()).getRightQuery().getProcessorPlan()); //$NON-NLS-1$ } else { sb.append("\n"); //$NON-NLS-1$ sb.append(withCommand.getCommand().getProcessorPlan()); } } sb.append("body\n"); //$NON-NLS-1$ } sb.append(this.root.toString()); return sb.toString(); }
@SuppressWarnings("unused") protected Command nextCommand() throws TeiidProcessingException, TeiidComponentException { //it's important to save the next command //to ensure that the subquery ids remain stable if (nextCommand == null) { nextCommand = (Command) processingCommand.clone(); if (evaluatedPlans != null) { for (WithQueryCommand with : ((QueryCommand)nextCommand).getWith()) { TupleBuffer tb = evaluatedPlans.get(with.getGroupSymbol()).collector.getTupleBuffer(); with.setTupleBuffer(tb); } } } return nextCommand; }
@SuppressWarnings("unused") protected Command nextCommand() throws TeiidProcessingException, TeiidComponentException { //it's important to save the next command //to ensure that the subquery ids remain stable if (nextCommand == null) { nextCommand = (Command) processingCommand.clone(); if (evaluatedPlans != null) { for (WithQueryCommand with : ((QueryCommand)nextCommand).getWith()) { TupleBuffer tb = evaluatedPlans.get(with.getGroupSymbol()).collector.getTupleBuffer(); with.setTupleBuffer(tb); } } } return nextCommand; }
@SuppressWarnings("unused") protected Command nextCommand() throws TeiidProcessingException, TeiidComponentException { //it's important to save the next command //to ensure that the subquery ids remain stable if (nextCommand == null) { nextCommand = (Command) processingCommand.clone(); if (evaluatedPlans != null) { for (WithQueryCommand with : ((QueryCommand)nextCommand).getWith()) { TupleBuffer tb = evaluatedPlans.get(with.getGroupSymbol()).collector.getTupleBuffer(); with.setTupleBuffer(tb); } } } return nextCommand; }
private void pullupWith(List<WithQueryCommand> with, List<SubqueryContainer<?>> subqueries, Set<GroupSymbol> knownWithGroups) { for (SubqueryContainer<?> subquery : subqueries) { if (subquery.getCommand() instanceof QueryCommand) { QueryCommand qc = (QueryCommand)subquery.getCommand(); if (qc.getWith() != null) { for (Iterator<WithQueryCommand> i = qc.getWith().iterator(); i.hasNext();) { WithQueryCommand wqc = i.next(); if (knownWithGroups.contains(wqc.getGroupSymbol())) { i.remove(); } } if (qc.getWith().isEmpty()) { qc.setWith(null); } } pullupWith(with, ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(qc), knownWithGroups); } } }
private void pullupWith(List<WithQueryCommand> with, List<SubqueryContainer<?>> subqueries, Set<GroupSymbol> knownWithGroups) { for (SubqueryContainer<?> subquery : subqueries) { if (subquery.getCommand() instanceof QueryCommand) { QueryCommand qc = (QueryCommand)subquery.getCommand(); if (qc.getWith() != null) { for (Iterator<WithQueryCommand> i = qc.getWith().iterator(); i.hasNext();) { WithQueryCommand wqc = i.next(); if (knownWithGroups.contains(wqc.getGroupSymbol())) { i.remove(); } } if (qc.getWith().isEmpty()) { qc.setWith(null); } } pullupWith(with, ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(qc), knownWithGroups); } } }
private void pullupWith(List<WithQueryCommand> with, List<SubqueryContainer<?>> subqueries, Set<GroupSymbol> knownWithGroups) { for (SubqueryContainer<?> subquery : subqueries) { if (subquery.getCommand() instanceof QueryCommand) { QueryCommand qc = (QueryCommand)subquery.getCommand(); if (qc.getWith() != null) { for (Iterator<WithQueryCommand> i = qc.getWith().iterator(); i.hasNext();) { WithQueryCommand wqc = i.next(); if (knownWithGroups.contains(wqc.getGroupSymbol())) { i.remove(); } } if (qc.getWith().isEmpty()) { qc.setWith(null); } } pullupWith(with, ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(qc), knownWithGroups); } } }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof WithQueryCommand)) { return false; } WithQueryCommand other = (WithQueryCommand)obj; return EquivalenceUtil.areEqual(groupSymbol, other.getGroupSymbol()) && EquivalenceUtil.areEqual(this.columns, other.getColumns()) && EquivalenceUtil.areEqual(this.queryExpression, other.queryExpression) && noInline == other.noInline && materialize == other.materialize && recursive == other.recursive; }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof WithQueryCommand)) { return false; } WithQueryCommand other = (WithQueryCommand)obj; return EquivalenceUtil.areEqual(groupSymbol, other.getGroupSymbol()) && EquivalenceUtil.areEqual(this.columns, other.getColumns()) && EquivalenceUtil.areEqual(this.queryExpression, other.queryExpression) && noInline == other.noInline && materialize == other.materialize && recursive == other.recursive; }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof WithQueryCommand)) { return false; } WithQueryCommand other = (WithQueryCommand)obj; return EquivalenceUtil.areEqual(groupSymbol, other.getGroupSymbol()) && EquivalenceUtil.areEqual(this.columns, other.getColumns()) && EquivalenceUtil.areEqual(this.queryExpression, other.queryExpression) && noInline == other.noInline && materialize == other.materialize && recursive == other.recursive; }
private void discoverWith( LinkedHashMap<String, WithQueryCommand> pushdownWith, Command command, List<WithQueryCommand> with, Collection<GroupSymbol> groups) throws QueryMetadataException, TeiidComponentException { for (GroupSymbol groupSymbol : groups) { if (!groupSymbol.isPushedCommonTable()) { continue; } WithQueryCommand clause = pushdownWith.get(groupSymbol.getNonCorrelationName()); if (clause == null) { continue; } TreeSet<GroupSymbol> temp = new TreeSet<GroupSymbol>(nonCorrelatedComparator); GroupCollectorVisitor.getGroupsIgnoreInlineViewsAndEvaluatableSubqueries(clause.getCommand(), temp); temp.removeAll(this.withGroups); discoverWith(pushdownWith, command, with, temp); with.add(clause.clone()); this.withGroups.add(clause.getGroupSymbol()); command.setSourceHint(SourceHint.combine(command.getSourceHint(), clause.getCommand().getSourceHint())); } }
private void discoverWith( LinkedHashMap<String, WithQueryCommand> pushdownWith, Command command, List<WithQueryCommand> with, Collection<GroupSymbol> groups) throws QueryMetadataException, TeiidComponentException { for (GroupSymbol groupSymbol : groups) { if (!groupSymbol.isPushedCommonTable()) { continue; } WithQueryCommand clause = pushdownWith.get(groupSymbol.getNonCorrelationName()); if (clause == null) { continue; } TreeSet<GroupSymbol> temp = new TreeSet<GroupSymbol>(nonCorrelatedComparator); GroupCollectorVisitor.getGroupsIgnoreInlineViewsAndEvaluatableSubqueries(clause.getCommand(), temp); temp.removeAll(this.withGroups); discoverWith(pushdownWith, command, with, temp); with.add(clause.clone()); this.withGroups.add(clause.getGroupSymbol()); command.setSourceHint(SourceHint.combine(command.getSourceHint(), clause.getCommand().getSourceHint())); } }
private void discoverWith( LinkedHashMap<String, WithQueryCommand> pushdownWith, Command command, List<WithQueryCommand> with, Collection<GroupSymbol> groups) throws QueryMetadataException, TeiidComponentException { for (GroupSymbol groupSymbol : groups) { if (!groupSymbol.isPushedCommonTable()) { continue; } WithQueryCommand clause = pushdownWith.get(groupSymbol.getNonCorrelationName()); if (clause == null) { continue; } TreeSet<GroupSymbol> temp = new TreeSet<GroupSymbol>(nonCorrelatedComparator); GroupCollectorVisitor.getGroupsIgnoreInlineViewsAndEvaluatableSubqueries(clause.getCommand(), temp); temp.removeAll(this.withGroups); discoverWith(pushdownWith, command, with, temp); with.add(clause.clone()); this.withGroups.add(clause.getGroupSymbol()); command.setSourceHint(SourceHint.combine(command.getSourceHint(), clause.getCommand().getSourceHint())); } }
@Override public void open() throws TeiidComponentException, TeiidProcessingException { if (with != null && tempTableStore.getProcessors() == null) { HashMap<String, TableProcessor> processors = new HashMap<String, TableProcessor>(); tempTableStore.setProcessors(processors); for (WithQueryCommand withCommand : this.with) { if (withCommand.isRecursive()) { SetQuery setQuery = (SetQuery)withCommand.getCommand(); ProcessorPlan initial = setQuery.getLeftQuery().getProcessorPlan(); QueryProcessor withProcessor = new QueryProcessor(initial, getContext().clone(), root.getBufferManager(), root.getDataManager()); processors.put(withCommand.getGroupSymbol().getName(), new RecursiveTableProcessor(withProcessor, withCommand.getColumns(), setQuery.getRightQuery().getProcessorPlan(), setQuery.isAll())); continue; } ProcessorPlan plan = withCommand.getCommand().getProcessorPlan(); QueryProcessor withProcessor = new QueryProcessor(plan, getContext().clone(), root.getBufferManager(), root.getDataManager()); processors.put(withCommand.getGroupSymbol().getName(), new TableProcessor(withProcessor, withCommand.getColumns())); } } this.root.open(); }
@Override public void open() throws TeiidComponentException, TeiidProcessingException { if (with != null && tempTableStore.getProcessors() == null) { HashMap<String, TableProcessor> processors = new HashMap<String, TableProcessor>(); tempTableStore.setProcessors(processors); for (WithQueryCommand withCommand : this.with) { if (withCommand.isRecursive()) { SetQuery setQuery = (SetQuery)withCommand.getCommand(); ProcessorPlan initial = setQuery.getLeftQuery().getProcessorPlan(); QueryProcessor withProcessor = new QueryProcessor(initial, getContext().clone(), root.getBufferManager(), root.getDataManager()); processors.put(withCommand.getGroupSymbol().getName(), new RecursiveTableProcessor(withProcessor, withCommand.getColumns(), setQuery.getRightQuery().getProcessorPlan(), setQuery.isAll())); continue; } ProcessorPlan plan = withCommand.getCommand().getProcessorPlan(); QueryProcessor withProcessor = new QueryProcessor(plan, getContext().clone(), root.getBufferManager(), root.getDataManager()); processors.put(withCommand.getGroupSymbol().getName(), new TableProcessor(withProcessor, withCommand.getColumns())); } } this.root.open(); }