Package org.teiid.query.util

Examples of org.teiid.query.util.CommandContext


        outputElements.add(new AggregateSymbol("bigAvg", "AVG", false, bigDecimal)); //$NON-NLS-1$ //$NON-NLS-2$
        node.setElements(outputElements);
       
        // Set grouping elements to null
        node.setGroupingElements(null);        
        CommandContext context = new CommandContext("pid", "test", null, null, 1);               //$NON-NLS-1$ //$NON-NLS-2$
       
        List[] data = new List[] {
            Arrays.asList(new Object[] { new BigDecimal("0.0") }),     //$NON-NLS-1$
            Arrays.asList(new Object[] { new BigDecimal("1.0") }),     //$NON-NLS-1$
            Arrays.asList(new Object[] { new BigDecimal("2.0") }),     //$NON-NLS-1$
View Full Code Here


       
        // Set grouping elements to null
        List groupingElements = new ArrayList();
        groupingElements.add(col1);
        node.setGroupingElements(groupingElements);        
        CommandContext context = new CommandContext("pid", "test", null, null, 1);               //$NON-NLS-1$ //$NON-NLS-2$
       
        List[] data = new List[] {
            Arrays.asList(new Object[] { new Integer(1), new BigDecimal("0.0") }),     //$NON-NLS-1$
            Arrays.asList(new Object[] { new Integer(1), new BigDecimal("1.0") }),     //$NON-NLS-1$
            Arrays.asList(new Object[] { new Integer(2), new BigDecimal("2.0") }),     //$NON-NLS-1$
View Full Code Here

        node.setElements(outputElements);
       
        List groupingElements = new ArrayList();
        groupingElements.add(col1);
        node.setGroupingElements(groupingElements);  
        CommandContext context = new CommandContext("pid", "test", null, null, 1);    //$NON-NLS-1$ //$NON-NLS-2$
       
        FakeDataManager dataMgr = new FakeDataManager();
        dataMgr.setThrowBlocked(true);
        Map valueMap = new HashMap();
        valueMap.put(new Integer(0), new Integer(1));
View Full Code Here

        if (groupBy) {
            List groupingElements = new ArrayList();
            groupingElements.add(new ElementSymbol("col1")); //$NON-NLS-1$
            node.setGroupingElements(groupingElements);
        }
        CommandContext context = new CommandContext("pid", "test", null, null, 1);               //$NON-NLS-1$ //$NON-NLS-2$
       
        List[] data = new List[] {
        };
       
        List[] expected = new List[] {
View Full Code Here

    @Test public void testDupSort() throws Exception {
        BufferManager mgr = BufferManagerFactory.getStandaloneBufferManager();

        GroupingNode node = getExampleGroupingNode();    
        node.setRemoveDuplicates(true);
        CommandContext context = new CommandContext("pid", "test", null, null,  1);               //$NON-NLS-1$ //$NON-NLS-2$
       
        List[] expected = new List[] {
            Arrays.asList(new Object[] { null, new Integer(1) }),
            Arrays.asList(new Object[] { new Integer(0), new Integer(1) }),
            Arrays.asList(new Object[] { new Integer(1), new Integer(1) }),
View Full Code Here

        TestOptimizer.checkAtomicQueries(new String[] {
            "SELECT pm1.g2.e4 FROM pm1.g2",
            "SELECT pm2.g1.e1, pm2.g1.e2, pm2.g1.e4 FROM pm2.g1 WHERE (pm2.g1.e1 IN (<dependent values>)) AND (pm2.g1.e2 IN (<dependent values>)) AND (pm2.g1.e4 IN (<dependent values>))",
            "SELECT pm1.g1.e1, pm1.g1.e2 FROM pm1.g1"
        }, plan);
        CommandContext cc = TestProcessor.createCommandContext();
        cc.setUserRequestSourceConcurrency(maxConcurrency);
        FakeTupleSource.resetStats();
        // Run query
        TestProcessor.helpProcess(plan, cc, dataManager, expected);

        assertEquals("Wrong number of concurrent source queries", concurrentOpen, FakeTupleSource.maxOpen);
View Full Code Here

        elements.add(elementSymbol_2);
        node.setIntoElements(elements);
        node.setMode(mode);
        node.setModelName("myModel"); //$NON-NLS-1$
       
        CommandContext context = new CommandContext();
        context.setProcessorID("processorID"); //$NON-NLS-1$
        BufferManager bm = NodeTestUtil.getTestBufferManager(tupleBatchSize, tupleBatchSize);
        ProcessorDataManager dataManager = new FakePDM(tupleBatchSize);
       
        child.initialize(context, bm, dataManager);
        node.initialize(context, bm, dataManager);
View Full Code Here

      };
    dataManager = new TempTableDataManager(hdm, bm, executor, cache, cache, new DefaultCacheFactory());
  }
 
  private void execute(String sql, List<?>... expectedResults) throws Exception {
    CommandContext cc = TestProcessor.createCommandContext();
    cc.setTempTableStore(tempStore);
    cc.setGlobalTableStore(globalStore);
    cc.setMetadata(metadata);
    CapabilitiesFinder finder = new DefaultCapabilitiesFinder();
    previousPlan = TestProcessor.helpGetPlan(TestProcessor.helpParse(sql), metadata, finder, cc);
    cc.setQueryProcessorFactory(new QueryProcessorFactoryImpl(BufferManagerFactory.getStandaloneBufferManager(), dataManager, finder, null, metadata));
    TestProcessor.doProcess(previousPlan, dataManager, expectedResults, cc);
  }
View Full Code Here

        CacheID id = new CacheID(session, pi, dummy.toString());

        PreparedPlan pPlan = new PreparedPlan();
        cache.put(id, Determinism.SESSION_DETERMINISTIC, pPlan, null);
        pPlan.setCommand(dummy);
        pPlan.setPlan(new RelationalPlan(new ProjectNode(i)), new CommandContext());
            AnalysisRecord analysisRecord = new AnalysisRecord(true, false);
        pPlan.setAnalysisRecord(analysisRecord);
        ArrayList<Reference> refs = new ArrayList<Reference>();
        refs.add(new Reference(1));
        pPlan.setReferences(refs);
View Full Code Here

       
        if (report.hasItems()) {
            ValidatorFailure firstFailure = report.getItems().iterator().next();
            throw new QueryValidatorException(firstFailure.getMessage());
        }
        QueryRewriter.rewrite(userCommand, metadata, new CommandContext());

        AnalysisRecord analysisRecord = new AnalysisRecord(false, DEBUG);
        try {
          if ( capabilitiesFinder == null ) capabilitiesFinder = new DefaultCapabilitiesFinder();
          ProcessorPlan plan = QueryOptimizer.optimizePlan(userCommand, metadata, null, capabilitiesFinder, analysisRecord, null);
View Full Code Here

TOP

Related Classes of org.teiid.query.util.CommandContext

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.