use of org.teiid.query.util.Options in project teiid by teiid.
the class TestSubqueryPushdown method testDontRewriteToJoinWithOtherCriteria.
@Test
public void testDontRewriteToJoinWithOtherCriteria() throws Exception {
CommandContext cc = new CommandContext();
cc.setOptions(new Options().subqueryUnnestDefault(true));
TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where pm3.g1.e1 in /*+ NO_UNNEST */ (select pm1.g1.e1 FROM pm1.g1 where e2 < pm3.g1.e2)", "SELECT e1 FROM pm3.g1 WHERE pm3.g1.e1 IN /*+ NO_UNNEST */ (SELECT pm1.g1.e1 FROM pm1.g1 WHERE e2 < pm3.g1.e2)", RealMetadataFactory.example4(), cc);
}
use of org.teiid.query.util.Options in project teiid by teiid.
the class TestSubqueryPushdown method testSubqueryRewriteToJoin.
@Test
public void testSubqueryRewriteToJoin() throws Exception {
CommandContext cc = new CommandContext();
cc.setOptions(new Options().subqueryUnnestDefault(true));
TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where exists (select pm1.g1.e1 FROM pm1.g1 where e1 = pm3.g1.e1)", "SELECT e1 FROM pm3.g1, (SELECT e1 FROM pm1.g1) AS X__1 WHERE pm3.g1.e1 = X__1.e1", RealMetadataFactory.example4(), cc);
}
use of org.teiid.query.util.Options in project teiid by teiid.
the class TestSubqueryPushdown method testSubqueryExpressionJoin.
@Test
public void testSubqueryExpressionJoin() throws Exception {
CommandContext cc = new CommandContext();
cc.setOptions(new Options().subqueryUnnestDefault(true));
TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where pm3.g1.e2 < (Select max(e2) from pm2.g2 where e1 = pm3.g1.e1 having convert(min(e2), string) > pm3.g1.e1)", "SELECT e1 FROM pm3.g1, (SELECT MAX(e2) AS expr1, e1, MIN(e2) AS expr3 FROM pm2.g2 GROUP BY e1) AS X__1 WHERE (convert(X__1.expr3, string) > pm3.g1.e1) AND (pm3.g1.e2 < X__1.expr1) AND (pm3.g1.e1 = X__1.e1)", RealMetadataFactory.example4(), cc);
}
use of org.teiid.query.util.Options in project teiid by teiid.
the class DQPCore method start.
public void start(DQPConfiguration theConfig) {
this.config = theConfig;
this.authorizationValidator = config.getAuthorizationValidator();
this.chunkSize = config.getLobChunkSizeInKB() * 1024;
this.processWorkerPool = config.getTeiidExecutor();
// we don't want cancellations waiting on normal processing, so they get a small dedicated pool
// TODO: overflow to the worker pool
// $NON-NLS-1$
timeoutExecutor = ExecutorUtils.newFixedThreadPool(3, "Server Side Timeout");
this.cancellationTimer = new EnhancedTimer(timeoutExecutor, timeoutExecutor);
this.maxActivePlans = config.getMaxActivePlans();
if (this.maxActivePlans > config.getMaxThreads()) {
LogManager.logWarning(LogConstants.CTX_DQP, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30006, this.maxActivePlans, config.getMaxThreads()));
this.maxActivePlans = config.getMaxThreads();
}
// for now options are scoped to the engine - vdb scoping is a todo
options = new Options();
options.setAssumeMatchingCollation(false);
options.setProperties(config.getProperties());
// $NON-NLS-1$
PropertiesUtils.setBeanProperties(options, options.getProperties(), "org.teiid", true);
this.bufferManager.setOptions(options);
// hack to set the max active plans
this.bufferManager.setMaxActivePlans(this.maxActivePlans);
try {
this.bufferManager.initialize();
} catch (TeiidComponentException e) {
throw new TeiidRuntimeException(QueryPlugin.Event.TEIID30496, e);
}
this.userRequestSourceConcurrency = config.getUserRequestSourceConcurrency();
if (this.userRequestSourceConcurrency < 1) {
this.userRequestSourceConcurrency = Math.min(config.getMaxThreads(), 2 * config.getMaxThreads() / this.maxActivePlans);
}
DataTierManagerImpl processorDataManager = new DataTierManagerImpl(this, this.bufferManager, this.config.isDetectingChangeEvents());
processorDataManager.setEventDistributor(eventDistributor);
dataTierMgr = new TempTableDataManager(processorDataManager, this.bufferManager, this.rsCache);
dataTierMgr.setExecutor(new TempTableDataManager.RequestExecutor() {
@Override
public void execute(String command, List<?> parameters) {
final String sessionId = DQPWorkContext.getWorkContext().getSessionId();
RequestMessage request = new RequestMessage(command);
request.setParameterValues(parameters);
request.setStatementType(StatementType.PREPARED);
ResultsFuture<ResultsMessage> result;
try {
result = executeRequest(0, request);
} catch (TeiidProcessingException e) {
throw new TeiidRuntimeException(e);
}
result.addCompletionListener(new ResultsFuture.CompletionListener<ResultsMessage>() {
@Override
public void onCompletion(ResultsFuture<ResultsMessage> future) {
terminateSession(sessionId);
}
});
}
@Override
public boolean isShutdown() {
return shutdown;
}
});
dataTierMgr.setEventDistributor(eventDistributor);
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
LogManager.logDetail(LogConstants.CTX_DQP, "DQPCore started maxThreads", this.config.getMaxThreads(), "maxActivePlans", this.maxActivePlans, "source concurrency", this.userRequestSourceConcurrency);
}
use of org.teiid.query.util.Options in project teiid by teiid.
the class TestOrderByProcessing method testNullOrdering4.
/**
* turns on virtualization
* @throws Exception
*/
@Test
public void testNullOrdering4() throws Exception {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
caps.setCapabilitySupport(Capability.QUERY_ORDERBY_NULL_ORDERING, true);
caps.setSourceProperty(Capability.QUERY_ORDERBY_DEFAULT_NULL_ORDER, NullOrder.UNKNOWN);
// $NON-NLS-1$
capFinder.addCapabilities("pm1", caps);
QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
CommandContext cc = new CommandContext();
cc.setOptions(new Options().pushdownDefaultNullOrder(true));
ProcessorPlan plan = TestOptimizer.getPlan(TestOptimizer.helpGetCommand("select e1 from pm1.g1 order by e1 desc, e2 asc", metadata, null), metadata, capFinder, null, true, cc);
// $NON-NLS-1$
TestOptimizer.checkAtomicQueries(new String[] { "SELECT g_0.e1 AS c_0 FROM pm1.g1 AS g_0 ORDER BY c_0 DESC NULLS LAST, g_0.e2 NULLS FIRST" }, plan);
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
Aggregations