@Override public Boolean requiresTransaction(boolean transactionalReads) { return plan.requiresTransaction(transactionalReads); }
@Override public Boolean requiresTransaction(boolean transactionalReads) { return plan.requiresTransaction(transactionalReads); }
@Override public Boolean requiresTransaction(boolean transactionalReads) { return plan.requiresTransaction(transactionalReads); }
@Override public Boolean requiresTransaction(boolean transactionalReads) { return getProcessorPlan().requiresTransaction(transactionalReads); }
@Override public Boolean requiresTransaction(boolean transactionalReads) { return getProcessorPlan().requiresTransaction(transactionalReads); }
@Override public Boolean requiresTransaction(boolean transactionalReads) { return getProcessorPlan().requiresTransaction(transactionalReads); }
@Override public Boolean requiresTransaction(boolean transactionalReads) { Boolean requiresTxn = queryPlan.requiresTransaction(transactionalReads); if (!Boolean.FALSE.equals(requiresTxn)) { return true; } Boolean forEach = rowProcedure.requiresTransaction(transactionalReads); if (Boolean.TRUE.equals(forEach)) { return true; } if (forEach == null) { if (!singleRow) { return true; } return null; } return false; }
@Override public Boolean requiresTransaction(boolean transactionalReads) { Boolean requiresTxn = queryPlan.requiresTransaction(transactionalReads); if (!Boolean.FALSE.equals(requiresTxn)) { return true; } Boolean forEach = rowProcedure.requiresTransaction(transactionalReads); if (Boolean.TRUE.equals(forEach)) { return true; } if (forEach == null) { if (!singleRow) { return true; } return null; } return false; }
@Override public Boolean requiresTransaction(boolean transactionalReads) { Boolean requiresTxn = queryPlan.requiresTransaction(transactionalReads); if (!Boolean.FALSE.equals(requiresTxn)) { return true; } Boolean forEach = rowProcedure.requiresTransaction(transactionalReads); if (Boolean.TRUE.equals(forEach)) { return true; } if (forEach == null) { if (!singleRow) { return true; } return null; } return false; }
public static Boolean requiresTransaction(boolean transactionalReads, List<SubqueryContainer<?>> valueIteratorProviders) { for (SubqueryContainer<?> subquery : valueIteratorProviders) { ProcessorPlan plan = subquery.getCommand().getProcessorPlan(); if (plan != null) { Boolean txn = plan.requiresTransaction(transactionalReads); if (txn == null || txn) { return true; //we can't ensure that this is read only } } } return false; }
public static Boolean requiresTransaction(boolean transactionalReads, List<SubqueryContainer<?>> valueIteratorProviders) { for (SubqueryContainer<?> subquery : valueIteratorProviders) { ProcessorPlan plan = subquery.getCommand().getProcessorPlan(); if (plan != null) { Boolean txn = plan.requiresTransaction(transactionalReads); if (txn == null || txn) { return true; //we can't ensure that this is read only } } } return false; }
public static Boolean requiresTransaction(boolean transactionalReads, List<SubqueryContainer<?>> valueIteratorProviders) { for (SubqueryContainer<?> subquery : valueIteratorProviders) { ProcessorPlan plan = subquery.getCommand().getProcessorPlan(); if (plan != null) { Boolean txn = plan.requiresTransaction(transactionalReads); if (txn == null || txn) { return true; //we can't ensure that this is read only } } } return false; }
@Test public void testProcAsTable(){ String sql = "select param1, param2, e1, e2 from pm1.vsp26 where param1=1 and param2='a'"; //$NON-NLS-1$ // Create expected results List<?>[] expected = new List[] { Arrays.asList(new Object[] { new Integer(1), "a", "a", new Integer(3)}), //$NON-NLS-1$ //$NON-NLS-2$ }; // Construct data manager with data FakeDataManager dataManager = new FakeDataManager(); TestProcessor.sampleData1(dataManager); // Plan query ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached()); assertFalse(plan.requiresTransaction(false)); assertTrue(plan.requiresTransaction(true)); //TODO: this should be false as there is only a single execution possible // Run query TestProcessor.helpProcess(plan, dataManager, expected); }
@Test public void testDDLProcTransaction() throws Exception { String ddl = "create foreign procedure proc (x integer) options (updatecount 2);"; //$NON-NLS-1$ TransformationMetadata metadata = RealMetadataFactory.fromDDL(ddl, "x", "y"); String userQuery = "EXEC proc(1)"; //$NON-NLS-1$ ProcessorPlan plan = getProcedurePlan(userQuery, metadata); assertTrue(plan.requiresTransaction(false)); }
/** * Technically this is not a full push-down, but the subquery will be evaluated prior to pushdown */ @Test public void testCompareSubquery4() throws TeiidComponentException, TeiidProcessingException { ProcessorPlan plan = helpPlan("Select e1 from pm1.g1 where e1 > (select e1 FROM pm2.g1 where e2 = 13)", RealMetadataFactory.example1Cached(), //$NON-NLS-1$ new String[] { "SELECT g_0.e1 FROM pm1.g1 AS g_0 WHERE g_0.e1 > (SELECT g_0.e1 FROM pm2.g1 AS g_0 WHERE g_0.e2 = 13)" }, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ checkNodeTypes(plan, FULL_PUSHDOWN); assertTrue(plan.requiresTransaction(true)); assertFalse(plan.requiresTransaction(false)); BasicSourceCapabilities bsc = getTypicalCapabilities(); bsc.setSourceProperty(Capability.TRANSACTION_SUPPORT, TransactionSupport.NONE); plan = helpPlan("Select e1 from pm1.g1 where e1 > (select e1 FROM pm2.g1 where e2 = 13)", RealMetadataFactory.example1Cached(), //$NON-NLS-1$ new String[] { "SELECT g_0.e1 FROM pm1.g1 AS g_0 WHERE g_0.e1 > (SELECT g_0.e1 FROM pm2.g1 AS g_0 WHERE g_0.e2 = 13)" }, new DefaultCapabilitiesFinder(bsc), ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ checkNodeTypes(plan, FULL_PUSHDOWN); assertFalse(plan.requiresTransaction(true)); assertFalse(plan.requiresTransaction(false)); }
@Test public void testDDLProcTransactionNonTransactionalJoin() throws Exception { String ddl = "create foreign procedure proc () returns table(col string);" + "create virtual procedure virt() as begin select * from proc, proc as x; end"; //$NON-NLS-1$ TransformationMetadata metadata = RealMetadataFactory.fromDDL(ddl, "x", "y"); String userQuery = "EXEC virt()"; //$NON-NLS-1$ ProcessorPlan plan = getProcedurePlan(userQuery, metadata); assertTrue(plan.requiresTransaction(false)); BasicSourceCapabilities bsc = new BasicSourceCapabilities(); bsc.setSourceProperty(Capability.TRANSACTION_SUPPORT, TransactionSupport.NONE); plan = getProcedurePlan(userQuery, metadata, new DefaultCapabilitiesFinder(bsc)); assertFalse(plan.requiresTransaction(false)); }
@Test public void testInsertQueryExpression() throws Exception { String sql = "insert into pm1.g1 (e1) select e1 from pm1.g2"; //$NON-NLS-1$ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached(); ProcessorPlan plan = helpPlan(sql, metadata, new String[] {"SELECT g_0.e1 FROM pm1.g2 AS g_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //requires a txn, since an non pushdown/iterated insert is used assertTrue(plan.requiresTransaction(false)); checkNodeTypes(plan, new int[] {1}, new Class[] {ProjectIntoNode.class}); }
@Test public void testQueryPhysical() { ProcessorPlan plan = helpPlan("SELECT pm1.g1.e1, e2, pm1.g1.e3 as a, e4 as b FROM pm1.g1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$ new String[] {"SELECT pm1.g1.e1, e2, pm1.g1.e3, e4 FROM pm1.g1"} ); //$NON-NLS-1$ assertNull(plan.requiresTransaction(true)); checkNodeTypes(plan, FULL_PUSHDOWN); }
@Test public void testSelectIntoWithDistinct() throws Exception { String sql = "select distinct e1 into #temp from pm1.g1"; //$NON-NLS-1$ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached(); ProcessorPlan plan = helpPlan(sql, metadata, new String[] {"SELECT DISTINCT g_0.e1 FROM pm1.g1 AS g_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$ //txn required, since the insert could be split assertTrue(plan.requiresTransaction(false)); checkNodeTypes(plan, FULL_PUSHDOWN); checkNodeTypes(plan, new int[] {1}, new Class[] {ProjectIntoNode.class}); }
@Test public void testFullPushdown() throws Exception { BasicSourceCapabilities bsc = TestOptimizer.getTypicalCapabilities(); bsc.setCapabilitySupport(Capability.CRITERIA_IS_DISTINCT, true); DefaultCapabilitiesFinder dcf = new DefaultCapabilitiesFinder(bsc); ProcessorPlan plan = helpPlan("SELECT pm1.g1.e2 is not distinct from 1 FROM pm1.g1", RealMetadataFactory.example1Cached(), //$NON-NLS-1$ new String[] {"SELECT g_0.e2 IS NOT DISTINCT FROM 1 FROM pm1.g1 AS g_0"}, dcf, ComparisonMode.EXACT_COMMAND_STRING ); //$NON-NLS-1$ assertNull(plan.requiresTransaction(true)); checkNodeTypes(plan, FULL_PUSHDOWN); HardcodedDataManager hdm = new HardcodedDataManager(RealMetadataFactory.example1Cached()); hdm.addData("SELECT g_0.e2 IS NOT DISTINCT FROM 1 FROM g1 AS g_0", Arrays.asList(true)); TestProcessor.helpProcess(plan, hdm, new List<?>[] {Arrays.asList(true)}); }