Package org.teiid.query.sql.lang

Examples of org.teiid.query.sql.lang.WithQueryCommand


                    supportsWithPushdown = false;
                  } else {
                    if (pushDownWith == null) {
                      pushDownWith = new ArrayList<WithQueryCommand>();
                    }
                    WithQueryCommand wqc = new WithQueryCommand(with.getGroupSymbol(), with.getColumns(), withCommand);
                    pushDownWith.add(wqc);
                  }
              names.add(with.getGroupSymbol().getCanonicalName());
        }
            if (modelID != null && supportsWithPushdown) {
View Full Code Here


      helpTestExpression("case when not x then y end", "CASE WHEN NOT (x) THEN y END", sce);
    }
   
    @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$
    }
View Full Code Here

      if (this.with != null) {
        if (withToProcess == null) {
          withToProcess = new LinkedList<WithQueryCommand>(with);
        }
        while (!withToProcess.isEmpty()) {
          WithQueryCommand withCommand = withToProcess.get(0);
          if (withProcessor == null) {
              ProcessorPlan plan = withCommand.getCommand().getProcessorPlan();
          withProcessor = new QueryProcessor(plan, getContext(), this.root.getBufferManager(), this.root.getDataManager());
          Create create = new Create();
          create.setElementSymbolsAsColumns(withCommand.getColumns());
          create.setTable(withCommand.getGroupSymbol());
          this.root.getDataManager().registerRequest(getContext(), create, TempMetadataAdapter.TEMP_MODEL.getID(), null, 0, -1);
          }
          while (true) {
            TupleBatch batch = withProcessor.nextBatch();
            Insert insert = new Insert(withCommand.getGroupSymbol(), withCommand.getColumns(), null);
                insert.setTupleSource(new CollectionTupleSource(batch.getTuples().iterator()));
                this.root.getDataManager().registerRequest(getContext(), insert, TempMetadataAdapter.TEMP_MODEL.getID(), null, 0, -1);
            if (batch.getTerminationFlag()) {
              break;
            }
          }
            this.tempTableStore.setUpdatable(withCommand.getGroupSymbol().getCanonicalName(), false);
            withToProcess.remove(0);
            withProcessor = null;
      }
        }           
        this.root.open();
View Full Code Here

TOP

Related Classes of org.teiid.query.sql.lang.WithQueryCommand

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.