Search in sources :

Example 86 with DefaultCapabilitiesFinder

use of org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder in project teiid by teiid.

the class TestTextTable method testHeaderWithSkip.

@Test
public void testHeaderWithSkip() throws Exception {
    // $NON-NLS-1$
    String sql = "select count(*) from texttable(? COLUMNS PARTNAME string HEADER 3 SKIP 5) x";
    List<?>[] expected = new List<?>[] { Arrays.asList(21) };
    FakeDataManager dataManager = new FakeDataManager();
    sampleData1(dataManager);
    processPreparedStatement(sql, expected, dataManager, new DefaultCapabilitiesFinder(), RealMetadataFactory.example1Cached(), Arrays.asList(clobFromFile("text/TextParts_HeaderRow2.csv")));
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) DefaultCapabilitiesFinder(org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder) Test(org.junit.Test)

Example 87 with DefaultCapabilitiesFinder

use of org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder in project teiid by teiid.

the class TestTextTable method testTextTableInvalidData.

@Test(expected = TeiidProcessingException.class)
public void testTextTableInvalidData() throws Exception {
    // $NON-NLS-1$
    String sql = "select count(*) from texttable(? COLUMNS PARTNAME string) x";
    FakeDataManager dataManager = new FakeDataManager();
    sampleData1(dataManager);
    char[] data = new char[5000];
    processPreparedStatement(sql, null, dataManager, new DefaultCapabilitiesFinder(), RealMetadataFactory.example1Cached(), Arrays.asList(new ClobType(new SerialClob(data))));
}
Also used : ClobType(org.teiid.core.types.ClobType) SerialClob(javax.sql.rowset.serial.SerialClob) DefaultCapabilitiesFinder(org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder) Test(org.junit.Test)

Example 88 with DefaultCapabilitiesFinder

use of org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder in project teiid by teiid.

the class TestTextTable method testNamedMultilineHeader.

@Test
public void testNamedMultilineHeader() throws Exception {
    String sql = "SELECT * from texttable(? COLUMNS Col3Head string HEADER) x";
    List<?>[] expected = new List<?>[] { Arrays.asList("VAL2"), Arrays.asList("VAL4"), Arrays.asList("abc"), Arrays.asList("VAL9") };
    FakeDataManager dataManager = new FakeDataManager();
    processPreparedStatement(sql, expected, dataManager, new DefaultCapabilitiesFinder(), RealMetadataFactory.example1Cached(), Arrays.asList(clobFromFile("text/test-file.txt.csv")));
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) DefaultCapabilitiesFinder(org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder) Test(org.junit.Test)

Example 89 with DefaultCapabilitiesFinder

use of org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder in project teiid by teiid.

the class TestTextTable method testTextTableFixedPartial.

@Test
public void testTextTableFixedPartial() throws Exception {
    // $NON-NLS-1$
    String sql = "select max(length(compkey)) from texttable(? COLUMNS compkey string width 76) x";
    List<?>[] expected = new List<?>[] { Arrays.asList(30) };
    FakeDataManager dataManager = new FakeDataManager();
    sampleData1(dataManager);
    processPreparedStatement(sql, expected, dataManager, new DefaultCapabilitiesFinder(), RealMetadataFactory.example1Cached(), Arrays.asList(clobFromFile("text/cdm_dos.txt")));
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) DefaultCapabilitiesFinder(org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder) Test(org.junit.Test)

Example 90 with DefaultCapabilitiesFinder

use of org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder in project teiid by teiid.

the class TestTextTable method testTextTableFixed.

@Test
public void testTextTableFixed() throws Exception {
    // $NON-NLS-1$
    String sql = "select max(compkey), max(cdm_id), max(currency), max(\"start\"), max(maturity), max(amount), count(*) from texttable(? COLUMNS compkey string width 76, CDM_ID string width 14, CURRENCY string width 9, \"START\" string width 31, MATURITY string width 31, AMOUNT double width 21, RECORDSOURCE string width 13, SUMMIT_ID string width 15, RATE double width 20, SPREAD double width 20, DESK string width 14) x";
    List<?>[] expected = new List<?>[] { Arrays.asList("000369USD05/20/200405/20/2007", "000369", "USD", "12/18/2000", "12/19/2005", 6.7209685146E8, 52) };
    FakeDataManager dataManager = new FakeDataManager();
    sampleData1(dataManager);
    processPreparedStatement(sql, expected, dataManager, new DefaultCapabilitiesFinder(), RealMetadataFactory.example1Cached(), Arrays.asList(clobFromFile("text/cdm_dos.txt")));
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) DefaultCapabilitiesFinder(org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder) Test(org.junit.Test)

Aggregations

DefaultCapabilitiesFinder (org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder)361 Test (org.junit.Test)344 BasicSourceCapabilities (org.teiid.query.optimizer.capabilities.BasicSourceCapabilities)277 List (java.util.List)121 CommandContext (org.teiid.query.util.CommandContext)95 TransformationMetadata (org.teiid.query.metadata.TransformationMetadata)89 ProcessorPlan (org.teiid.query.processor.ProcessorPlan)87 HardcodedDataManager (org.teiid.query.processor.HardcodedDataManager)42 QueryMetadataInterface (org.teiid.query.metadata.QueryMetadataInterface)41 Command (org.teiid.query.sql.lang.Command)23 CapabilitiesFinder (org.teiid.query.optimizer.capabilities.CapabilitiesFinder)17 FakeCapabilitiesFinder (org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder)15 ArrayList (java.util.ArrayList)13 DataPolicyMetadata (org.teiid.adminapi.impl.DataPolicyMetadata)13 PermissionMetaData (org.teiid.adminapi.impl.DataPolicyMetadata.PermissionMetaData)13 Table (org.teiid.metadata.Table)12 AnalysisRecord (org.teiid.query.analysis.AnalysisRecord)7 RelationalPlan (org.teiid.query.processor.relational.RelationalPlan)7 TeiidComponentException (org.teiid.core.TeiidComponentException)6 TeiidProcessingException (org.teiid.core.TeiidProcessingException)6