Examples of CommandContext


Examples of org.teiid.query.util.CommandContext

    @Test public void testExecCount()throws Exception{
        // Setup
        AccessNode node = new AccessNode(1);
      Query query = (Query)TestResolver.helpResolve("SELECT e1, e2 FROM pm1.g1 WHERE e2 = 5", FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
        node.setCommand(query);
        CommandContext context = new CommandContext();
        context.setProcessorID("processorID"); //$NON-NLS-1$
        BufferManager bm = BufferManagerFactory.getStandaloneBufferManager();
        FakeDataManager dataManager = new FakeDataManager();
        TestProcessor.sampleData1(dataManager);
        node.setElements(query.getProjectedSymbols());
        node.initialize(context, bm, dataManager);
View Full Code Here

Examples of org.teiid.query.util.CommandContext

      List<Boolean> shouldEvaluate = new ArrayList<Boolean>(commands.size());
      for (Command command : commands) {
      shouldEvaluate.add(EvaluatableVisitor.needsProcessingEvaluation(command));
    }
        BatchedUpdateNode node = new BatchedUpdateNode(1, commands, Collections.EMPTY_LIST, shouldEvaluate, "myModelName"); //$NON-NLS-1$
        CommandContext context = new CommandContext();
        context.setProcessorID("myProcessorID"); //$NON-NLS-1$
        context.setMetadata(md);
        node.initialize(context, Mockito.mock(BufferManager.class), pdm);
        return node;
    }
View Full Code Here

Examples of org.teiid.query.util.CommandContext

   
    public static final int BATCH_SIZE = 100;
   
    private void helpTestSort(List elements, List[] data, List sortElements, List sortTypes, List[] expected, Mode mode) throws TeiidComponentException, TeiidProcessingException {
        BufferManager mgr = NodeTestUtil.getTestBufferManager(100, BATCH_SIZE, BATCH_SIZE);
        CommandContext context = new CommandContext ("pid", "test", null, null, 1);               //$NON-NLS-1$ //$NON-NLS-2$
       
        BlockingFakeRelationalNode dataNode = new BlockingFakeRelationalNode(2, data);
        dataNode.setReturnPeriod(3);
        dataNode.setElements(elements);
        dataNode.initialize(context, mgr, null);   
View Full Code Here

Examples of org.teiid.query.util.CommandContext

   
   
    private Expression helpTestRewriteExpression(String original, String expected, QueryMetadataInterface metadata) throws TeiidComponentException, TeiidProcessingException {
      Expression actualExp = QueryParser.getQueryParser().parseExpression(original);
      ResolverVisitor.resolveLanguageObject(actualExp, metadata);
      CommandContext context = new CommandContext();
      context.setBufferManager(BufferManagerFactory.getStandaloneBufferManager());
      actualExp = QueryRewriter.rewriteExpression(actualExp, null, context, metadata);
      if (expected != null) {
        Expression expectedExp = QueryParser.getQueryParser().parseExpression(expected);
        ResolverVisitor.resolveLanguageObject(expectedExp, metadata);
        assertEquals(expectedExp, actualExp);
View Full Code Here

Examples of org.teiid.query.util.CommandContext

    @Test public void testRewriteExecEnv() throws Exception {
        Command command = QueryParser.getQueryParser().parseCommand("exec pm1.sq2(env('sessionid'))");             //$NON-NLS-1$
       
        QueryResolver.resolveCommand(command, FakeMetadataFactory.example1Cached());
       
        CommandContext context = new CommandContext();
        Properties props = new Properties();
        props.setProperty(ContextProperties.SESSION_ID, "1"); //$NON-NLS-1$
        context.setEnvironmentProperties(props);
        Command rewriteCommand = QueryRewriter.rewrite(command, FakeMetadataFactory.example1Cached(), context);
       
        assertEquals("EXEC pm1.sq2('1')", rewriteCommand.toString()); //$NON-NLS-1$
    }
View Full Code Here

Examples of org.teiid.query.util.CommandContext

        if (failures.size() > 0){
            fail("Exception during validation (" + repo); //$NON-NLS-1$
        }
       
    // rewrite
    command = QueryRewriter.rewrite(command, md, new CommandContext());

        return command;
    }
View Full Code Here

Examples of org.teiid.query.util.CommandContext

        if (capFinder == null){
            capFinder = getGenericFinder();
        }
       
        // Collect atomic queries
        ProcessorPlan plan = getPlan(command, md, capFinder, analysisRecord, mode != ComparisonMode.FAILED_PLANNING, new CommandContext());
              
        if (mode == ComparisonMode.CORRECTED_COMMAND_STRING) {
            checkAtomicQueries(expectedAtomic, plan, md, capFinder);
        } else if (mode == ComparisonMode.EXACT_COMMAND_STRING) {
            checkAtomicQueries(expectedAtomic, plan);
View Full Code Here

Examples of org.teiid.query.util.CommandContext

      ProcessorDataManager dataMgr, List[] expected,
      RelationalNode child,
      SelectNode selectNode) throws TeiidComponentException,
      TeiidProcessingException {
    BufferManager mgr = BufferManagerFactory.getStandaloneBufferManager();
        CommandContext context = new CommandContext("pid", "test", null, null, 1);               //$NON-NLS-1$ //$NON-NLS-2$
       
        child.setElements(childElements);
        child.initialize(context, mgr, dataMgr);
    selectNode.setCriteria(criteria);
        selectNode.setElements(elements);
View Full Code Here

Examples of org.teiid.query.util.CommandContext

    tb.close();
   
    BufferManager bm = fbs.getBufferManager();
    CachedResults results = new CachedResults();
    ProcessorPlan plan = new FakeProcessorPlan(0);
    CommandContext cc = new CommandContext();
    Table t = RealMetadataFactory.exampleBQT().getGroupID("bqt1.smalla");
    cc.accessedDataObject(t);
    plan.setContext(cc);
    results.setResults(tb, plan);
    results.setCommand(new Query());
    Cache cache = new DefaultCache("dummy"); //$NON-NLS-1$
    long ts = results.getAccessInfo().getCreationTime();
View Full Code Here

Examples of org.teiid.query.util.CommandContext

       
        IDGenerator idGenerator = new IDGenerator();
        idGenerator.setDefaultFactory(new IntegerIDFactory());           
       
        Properties props = new Properties();
        CommandContext context = new CommandContext("0", "test", "user", null, vdb.getName(), vdb.getVersion(), props, false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        context.setPlanToProcessConverter(new MultiSourcePlanToProcessConverter(metadata, idGenerator, analysis, finder, multiSourceModels, dqpContext, context));

        ProcessorPlan plan = QueryOptimizer.optimizePlan(command, wrapper, idGenerator, finder, analysis, context);
                       
        if(DEBUG) {
            System.out.println("\nMultiSource Plan:"); //$NON-NLS-1$
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.