Search in sources :

Example 1 with ExecutionContextImpl

use of org.teiid.dqp.internal.datamgr.ExecutionContextImpl in project teiid by teiid.

the class TestOracleTranslator method testSourceHint1.

@Test
public void testSourceHint1() throws Exception {
    ExecutionContextImpl impl = new FakeExecutionContextImpl();
    impl.setHints(Arrays.asList("hello world"));
    helpTestVisitor(getTestVDB(), "select part_name from parts union select part_id from parts", impl, null, "SELECT /*+ hello world */ g_1.PART_NAME AS c_0 FROM PARTS g_1 UNION SELECT g_0.PART_ID AS c_0 FROM PARTS g_0", true);
}
Also used : FakeExecutionContextImpl(org.teiid.dqp.internal.datamgr.FakeExecutionContextImpl) ExecutionContextImpl(org.teiid.dqp.internal.datamgr.ExecutionContextImpl) FakeExecutionContextImpl(org.teiid.dqp.internal.datamgr.FakeExecutionContextImpl) Test(org.junit.Test)

Example 2 with ExecutionContextImpl

use of org.teiid.dqp.internal.datamgr.ExecutionContextImpl in project teiid by teiid.

the class TestOracleTranslator method testOracleCommentPayload.

/**
 * Case 3744.  Test that an Oracle-specific db hint, delivered as a String via command
 * payload, is added to the translated SQL.
 *
 * @since 4.3
 */
@Test
public void testOracleCommentPayload() throws Exception {
    // $NON-NLS-1$
    String input = "SELECT part_name, rownum FROM parts";
    // $NON-NLS-1$
    String output = "SELECT /*+ ALL_ROWS */ PARTS.PART_NAME, ROWNUM FROM PARTS";
    // $NON-NLS-1$
    String hint = "/*+ ALL_ROWS */";
    // $NON-NLS-1$
    ExecutionContext context = new ExecutionContextImpl(null, 1, hint, null, "", 1, null, null);
    helpTestVisitor(getTestVDB(), input, context, null, output, false);
}
Also used : ExecutionContext(org.teiid.translator.ExecutionContext) ExecutionContextImpl(org.teiid.dqp.internal.datamgr.ExecutionContextImpl) FakeExecutionContextImpl(org.teiid.dqp.internal.datamgr.FakeExecutionContextImpl) Test(org.junit.Test)

Example 3 with ExecutionContextImpl

use of org.teiid.dqp.internal.datamgr.ExecutionContextImpl in project teiid by teiid.

the class TestOracleTranslator method testSourceHint.

@Test
public void testSourceHint() throws Exception {
    ExecutionContextImpl impl = new FakeExecutionContextImpl();
    impl.setHints(Arrays.asList("hello world"));
    helpTestVisitor(getTestVDB(), "select part_name from parts", impl, null, "SELECT /*+ hello world */ g_0.PART_NAME FROM PARTS g_0", true);
}
Also used : FakeExecutionContextImpl(org.teiid.dqp.internal.datamgr.FakeExecutionContextImpl) ExecutionContextImpl(org.teiid.dqp.internal.datamgr.ExecutionContextImpl) FakeExecutionContextImpl(org.teiid.dqp.internal.datamgr.FakeExecutionContextImpl) Test(org.junit.Test)

Example 4 with ExecutionContextImpl

use of org.teiid.dqp.internal.datamgr.ExecutionContextImpl in project teiid by teiid.

the class TestOracleTranslator method testSourceHint3.

@Test
public void testSourceHint3() throws Exception {
    ExecutionContextImpl impl = new FakeExecutionContextImpl();
    impl.setHints(Arrays.asList("hello world"));
    impl.setGeneralHints(Arrays.asList("other"));
    helpTestVisitor(getTestVDB(), "select part_name from parts", impl, null, "SELECT /*+ hello world other */ g_0.PART_NAME FROM PARTS g_0", true);
}
Also used : FakeExecutionContextImpl(org.teiid.dqp.internal.datamgr.FakeExecutionContextImpl) ExecutionContextImpl(org.teiid.dqp.internal.datamgr.ExecutionContextImpl) FakeExecutionContextImpl(org.teiid.dqp.internal.datamgr.FakeExecutionContextImpl) Test(org.junit.Test)

Example 5 with ExecutionContextImpl

use of org.teiid.dqp.internal.datamgr.ExecutionContextImpl in project teiid by teiid.

the class TestOracleTranslator method testSourceHint2.

@Test
public void testSourceHint2() throws Exception {
    ExecutionContextImpl impl = new FakeExecutionContextImpl();
    impl.setHints(Arrays.asList("hello world"));
    helpTestVisitor(getTestVDB(), "with x (y) as /*+ no_inline */ (select part_name from parts) select y from x", impl, null, "WITH x AS (SELECT g_0.PART_NAME AS y FROM PARTS g_0) SELECT /*+ hello world */ g_1.y FROM x g_1", true);
}
Also used : FakeExecutionContextImpl(org.teiid.dqp.internal.datamgr.FakeExecutionContextImpl) ExecutionContextImpl(org.teiid.dqp.internal.datamgr.ExecutionContextImpl) FakeExecutionContextImpl(org.teiid.dqp.internal.datamgr.FakeExecutionContextImpl) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)6 ExecutionContextImpl (org.teiid.dqp.internal.datamgr.ExecutionContextImpl)6 FakeExecutionContextImpl (org.teiid.dqp.internal.datamgr.FakeExecutionContextImpl)6 ExecutionContext (org.teiid.translator.ExecutionContext)2