private void processWith(final QueryCommand command, List<WithQueryCommand> withList) throws QueryMetadataException, TeiidComponentException { for (int i = 0; i < withList.size(); i++) { WithQueryCommand with = withList.get(i); //check for a duplicate with clause, which can occur in a self-join scenario WithQueryCommand existing = this.withPlanningState.withList.get(with.getCommand()); if (existing != null) { final GroupSymbol old = with.getGroupSymbol(); replaceSymbol(command, old, existing.getGroupSymbol()); continue; } final GroupSymbol old = with.getGroupSymbol(); if (!context.getGroups().add(old.getName()) || old.getName().matches("(g|v)_\\d*")) { final GroupSymbol gs = RulePlaceAccess.recontextSymbol(old, context.getGroups()); LinkedHashMap<ElementSymbol, Expression> replacementSymbols = FrameUtil.buildSymbolMap(old, gs, metadata); gs.setDefinition(null); //update the with clause with the new group name / columns with.setGroupSymbol(gs); with.setColumns(new ArrayList(replacementSymbols.values())); //we use equality checks here because there may be a similarly named at lower scopes replaceSymbol(command, old, gs); } this.context.getAliasMapping().put(with.getGroupSymbol().getName(), old.getName()); this.withPlanningState.withList.put(with.getCommand(), with); } }
private void processWith(final QueryCommand command, List<WithQueryCommand> withList) throws QueryMetadataException, TeiidComponentException { for (int i = 0; i < withList.size(); i++) { WithQueryCommand with = withList.get(i); //check for a duplicate with clause, which can occur in a self-join scenario WithQueryCommand existing = this.withPlanningState.withList.get(with.getCommand()); if (existing != null) { final GroupSymbol old = with.getGroupSymbol(); replaceSymbol(command, old, existing.getGroupSymbol()); continue; } final GroupSymbol old = with.getGroupSymbol(); if (!context.getGroups().add(old.getName()) || old.getName().matches("(g|v)_\\d*")) { final GroupSymbol gs = RulePlaceAccess.recontextSymbol(old, context.getGroups()); LinkedHashMap<ElementSymbol, Expression> replacementSymbols = FrameUtil.buildSymbolMap(old, gs, metadata); gs.setDefinition(null); //update the with clause with the new group name / columns with.setGroupSymbol(gs); with.setColumns(new ArrayList(replacementSymbols.values())); //we use equality checks here because there may be a similarly named at lower scopes replaceSymbol(command, old, gs); } this.context.getAliasMapping().put(with.getGroupSymbol().getName(), old.getName()); this.withPlanningState.withList.put(with.getCommand(), with); } }
private void processWith(final QueryCommand command, List<WithQueryCommand> withList) throws QueryMetadataException, TeiidComponentException { for (int i = 0; i < withList.size(); i++) { WithQueryCommand with = withList.get(i); //check for a duplicate with clause, which can occur in a self-join scenario WithQueryCommand existing = this.withPlanningState.withList.get(with.getCommand()); if (existing != null) { final GroupSymbol old = with.getGroupSymbol(); replaceSymbol(command, old, existing.getGroupSymbol()); continue; } final GroupSymbol old = with.getGroupSymbol(); if (!context.getGroups().add(old.getName()) || old.getName().matches("(g|v)_\\d*")) { final GroupSymbol gs = RulePlaceAccess.recontextSymbol(old, context.getGroups()); LinkedHashMap<ElementSymbol, Expression> replacementSymbols = FrameUtil.buildSymbolMap(old, gs, metadata); gs.setDefinition(null); //update the with clause with the new group name / columns with.setGroupSymbol(gs); with.setColumns(new ArrayList(replacementSymbols.values())); //we use equality checks here because there may be a similarly named at lower scopes replaceSymbol(command, old, gs); } this.context.getAliasMapping().put(with.getGroupSymbol().getName(), old.getName()); this.withPlanningState.withList.put(with.getCommand(), with); } }
if (withQueryCommand.getColumns() == null) { List<ElementSymbol> columns = ResolverUtil.resolveElementsInGroup(withQueryCommand.getGroupSymbol(), metadata); withQueryCommand.setColumns(LanguageObject.Util.deepClone(columns, ElementSymbol.class));
if (withQueryCommand.getColumns() == null) { List<ElementSymbol> columns = ResolverUtil.resolveElementsInGroup(withQueryCommand.getGroupSymbol(), metadata); withQueryCommand.setColumns(LanguageObject.Util.deepClone(columns, ElementSymbol.class));
if (withQueryCommand.getColumns() == null) { List<ElementSymbol> columns = ResolverUtil.resolveElementsInGroup(withQueryCommand.getGroupSymbol(), metadata); withQueryCommand.setColumns(LanguageObject.Util.deepClone(columns, ElementSymbol.class));