@Override public WithQueryCommand clone() { WithQueryCommand clone = new WithQueryCommand(groupSymbol.clone(), LanguageObject.Util.deepClone(columns, ElementSymbol.class), null); if (queryExpression != null) { clone.queryExpression = (QueryCommand)queryExpression.clone(); } clone.tupleBuffer = this.tupleBuffer; clone.recursive = recursive; clone.noInline = noInline; clone.materialize = materialize; return clone; }
@Override public WithQueryCommand clone() { WithQueryCommand clone = new WithQueryCommand(groupSymbol.clone(), LanguageObject.Util.deepClone(columns, ElementSymbol.class), null); if (queryExpression != null) { clone.queryExpression = (QueryCommand)queryExpression.clone(); } clone.tupleBuffer = this.tupleBuffer; clone.recursive = recursive; clone.noInline = noInline; clone.materialize = materialize; return clone; }
@Override public WithQueryCommand clone() { WithQueryCommand clone = new WithQueryCommand(groupSymbol.clone(), LanguageObject.Util.deepClone(columns, ElementSymbol.class), null); if (queryExpression != null) { clone.queryExpression = (QueryCommand)queryExpression.clone(); } clone.tupleBuffer = this.tupleBuffer; clone.recursive = recursive; clone.noInline = noInline; clone.materialize = materialize; return clone; }
final public WithQueryCommand withListElement(ParseInfo info) throws ParseException { String name = null; List<ElementSymbol> columns = null; QueryCommand queryExpression = null; Token lparen = null; name = id(Boolean.FALSE); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LPAREN: columns = columnList(true, true); break; default: jj_la1[88] = jj_gen; ; } jj_consume_token(AS); lparen = jj_consume_token(LPAREN); queryExpression = queryExpression(info); jj_consume_token(RPAREN); WithQueryCommand result = new WithQueryCommand(new GroupSymbol(name), columns, queryExpression); parseWithHints(lparen, result); {if (true) return result;} throw new Error("Missing return statement in function"); }
final public WithQueryCommand withListElement(ParseInfo info) throws ParseException { String name = null; List<ElementSymbol> columns = null; QueryCommand queryExpression = null; Token lparen = null; name = id(Boolean.FALSE); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LPAREN: columns = columnList(true, true); break; default: jj_la1[87] = jj_gen; ; } jj_consume_token(AS); lparen = jj_consume_token(LPAREN); queryExpression = queryExpression(info); jj_consume_token(RPAREN); WithQueryCommand result = new WithQueryCommand(new GroupSymbol(name), columns, queryExpression); parseWithHints(lparen, result); {if (true) return result;} throw new Error("Missing return statement in function"); }
final public WithQueryCommand withListElement(ParseInfo info) throws ParseException { String name = null; List<ElementSymbol> columns = null; QueryCommand queryExpression = null; Token lparen = null; name = id(Boolean.FALSE); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LPAREN: columns = columnList(true, true); break; default: jj_la1[87] = jj_gen; ; } jj_consume_token(AS); lparen = jj_consume_token(LPAREN); queryExpression = queryExpression(info); jj_consume_token(RPAREN); WithQueryCommand result = new WithQueryCommand(new GroupSymbol(name), columns, queryExpression); parseWithHints(lparen, result); {if (true) return result;} throw new Error("Missing return statement in function"); }
private boolean isPushdownValid(WithQueryCommand with, SetQuery setQuery, Object modelID, QueryCommand withCommand, RelationalPlan subPlan1) throws QueryMetadataException, TeiidComponentException { AccessNode aNode1 = CriteriaCapabilityValidatorVisitor.getAccessNode(subPlan1); if (aNode1 == null) { return false; } Object modelID1 = CriteriaCapabilityValidatorVisitor.validateCommandPushdown(null, metadata, capFinder, aNode1, false); QueryCommand withCommand1 = CriteriaCapabilityValidatorVisitor.getQueryCommand(aNode1); if (modelID1 == null || withCommand1 == null) { return false; } //if we are the same connector for each, then we should be good to proceed if (CapabilitiesUtil.isSameConnector(modelID, modelID1, metadata, capFinder)) { SetQuery pushdownSetQuery = new SetQuery(Operation.UNION, setQuery.isAll(), withCommand, withCommand1); WithQueryCommand wqc = new WithQueryCommand(with.getGroupSymbol(), with.getColumns(), pushdownSetQuery); wqc.setRecursive(true); this.withPlanningState.pushdownWith.put(with.getGroupSymbol().getName(), wqc); return true; } return false; }
private boolean isPushdownValid(WithQueryCommand with, SetQuery setQuery, Object modelID, QueryCommand withCommand, RelationalPlan subPlan1) throws QueryMetadataException, TeiidComponentException { AccessNode aNode1 = CriteriaCapabilityValidatorVisitor.getAccessNode(subPlan1); if (aNode1 == null) { return false; } Object modelID1 = CriteriaCapabilityValidatorVisitor.validateCommandPushdown(null, metadata, capFinder, aNode1, false); QueryCommand withCommand1 = CriteriaCapabilityValidatorVisitor.getQueryCommand(aNode1); if (modelID1 == null || withCommand1 == null) { return false; } //if we are the same connector for each, then we should be good to proceed if (CapabilitiesUtil.isSameConnector(modelID, modelID1, metadata, capFinder)) { SetQuery pushdownSetQuery = new SetQuery(Operation.UNION, setQuery.isAll(), withCommand, withCommand1); WithQueryCommand wqc = new WithQueryCommand(with.getGroupSymbol(), with.getColumns(), pushdownSetQuery); wqc.setRecursive(true); this.withPlanningState.pushdownWith.put(with.getGroupSymbol().getName(), wqc); return true; } return false; }
private boolean isPushdownValid(WithQueryCommand with, SetQuery setQuery, Object modelID, QueryCommand withCommand, RelationalPlan subPlan1) throws QueryMetadataException, TeiidComponentException { AccessNode aNode1 = CriteriaCapabilityValidatorVisitor.getAccessNode(subPlan1); if (aNode1 == null) { return false; } Object modelID1 = CriteriaCapabilityValidatorVisitor.validateCommandPushdown(null, metadata, capFinder, aNode1, false); QueryCommand withCommand1 = CriteriaCapabilityValidatorVisitor.getQueryCommand(aNode1); if (modelID1 == null || withCommand1 == null) { return false; } //if we are the same connector for each, then we should be good to proceed if (CapabilitiesUtil.isSameConnector(modelID, modelID1, metadata, capFinder)) { SetQuery pushdownSetQuery = new SetQuery(Operation.UNION, setQuery.isAll(), withCommand, withCommand1); WithQueryCommand wqc = new WithQueryCommand(with.getGroupSymbol(), with.getColumns(), pushdownSetQuery); wqc.setRecursive(true); this.withPlanningState.pushdownWith.put(with.getGroupSymbol().getName(), wqc); return true; } return false; }
@Test public void testWithClause() throws Exception { Query query = getOrderByQuery(null); query.setWith(Arrays.asList(new WithQueryCommand(new GroupSymbol("x"), null, getOrderByQuery(null)))); helpTest("WITH x AS (SELECT a FROM db.g WHERE b = aString) SELECT a FROM db.g WHERE b = aString", "WITH x AS (SELECT a FROM db.g WHERE b = aString) SELECT a FROM db.g WHERE b = aString", query); //$NON-NLS-1$ //$NON-NLS-2$ }
continue; WithQueryCommand wqc = new WithQueryCommand(with.getGroupSymbol(), with.getColumns(), withCommand); wqc.setNoInline(with.isNoInline()); ((TempMetadataID)with.getGroupSymbol().getMetadataID()).getTableData().setModel(modelID);
continue; WithQueryCommand wqc = new WithQueryCommand(with.getGroupSymbol(), with.getColumns(), withCommand); wqc.setNoInline(with.isNoInline()); ((TempMetadataID)with.getGroupSymbol().getMetadataID()).getTableData().setModel(modelID);
continue; WithQueryCommand wqc = new WithQueryCommand(with.getGroupSymbol(), with.getColumns(), withCommand); wqc.setNoInline(with.isNoInline()); ((TempMetadataID)with.getGroupSymbol().getMetadataID()).getTableData().setModel(modelID);
subPlan.setOutputElements(elems); plans.put(entry.getKey(), subPlan); WithQueryCommand withQueryCommand = new WithQueryCommand(entry.getKey(), elems, null); qc.getWith().add(withQueryCommand);
subPlan.setOutputElements(elems); plans.put(entry.getKey(), subPlan); WithQueryCommand withQueryCommand = new WithQueryCommand(entry.getKey(), elems, null); qc.getWith().add(withQueryCommand);
subPlan.setOutputElements(elems); plans.put(entry.getKey(), subPlan); WithQueryCommand withQueryCommand = new WithQueryCommand(entry.getKey(), elems, null); qc.getWith().add(withQueryCommand);