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")));
}
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))));
}
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")));
}
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")));
}
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")));
}
Aggregations