use of org.teiid.translator.simpledb.SimpleDBSQLVisitor in project teiid by teiid.
the class TestSimpleDBSQLVisitor method testIN.
@Test
public void testIN() throws Exception {
TransformationMetadata tm = RealMetadataFactory.fromDDL("create foreign table item (\"itemName()\" integer, attribute string);", "x", "y");
TranslationUtility tu = new TranslationUtility(tm);
Command c = tu.parseCommand("select * from item where \"itemName()\" in (1, 2)");
SimpleDBSQLVisitor visitor = new SimpleDBSQLVisitor();
visitor.append(c);
assertEquals("SELECT attribute FROM item WHERE itemName() IN ('1', '2')", visitor.toString());
}
use of org.teiid.translator.simpledb.SimpleDBSQLVisitor in project teiid by teiid.
the class TestSimpleDBSQLVisitor method testEveryNotNull.
@Test
public void testEveryNotNull() throws Exception {
SimpleDBExecutionFactory translator = new SimpleDBExecutionFactory();
translator.start();
MetadataFactory mf = TestDDLParser.helpParse("create foreign table item (\"itemName()\" integer, attribute string[]);", "y");
TransformationMetadata metadata = RealMetadataFactory.createTransformationMetadata(mf.asMetadataStore(), "x", new FunctionTree("foo", new UDFSource(translator.getPushDownFunctions())));
TranslationUtility tu = new TranslationUtility(metadata);
Command c = tu.parseCommand("select * from item where simpledb.every(attribute) is not null");
SimpleDBSQLVisitor visitor = new SimpleDBSQLVisitor();
visitor.append(c);
assertEquals("SELECT attribute FROM item WHERE SIMPLEDB.EVERY(attribute) IS NOT NULL", visitor.toString());
}
use of org.teiid.translator.simpledb.SimpleDBSQLVisitor in project teiid by teiid.
the class TestSimpleDBSQLVisitor method testOrderByAllow.
@Test
public void testOrderByAllow() throws Exception {
TransformationMetadata tm = RealMetadataFactory.fromDDL("create foreign table item (\"itemName()\" string, attribute string);", "x", "y");
TranslationUtility tu = new TranslationUtility(tm);
Command c = tu.parseCommand("select * from item where \"itemName()\" = 'name' order by \"itemName()\"");
SimpleDBSQLVisitor visitor = new SimpleDBSQLVisitor();
visitor.append(c);
visitor.checkExceptions();
assertEquals("SELECT attribute FROM item WHERE itemName() = 'name' ORDER BY itemName()", visitor.toString());
}
use of org.teiid.translator.simpledb.SimpleDBSQLVisitor in project teiid by teiid.
the class TestSimpleDBSQLVisitor method testArrayCompare.
@Test
public void testArrayCompare() throws Exception {
SimpleDBExecutionFactory translator = new SimpleDBExecutionFactory();
translator.start();
MetadataFactory mf = TestDDLParser.helpParse("create foreign table item (\"itemName()\" integer, attribute string[]);", "y");
TransformationMetadata metadata = RealMetadataFactory.createTransformationMetadata(mf.asMetadataStore(), "x", new FunctionTree("foo", new UDFSource(translator.getPushDownFunctions())));
TranslationUtility tu = new TranslationUtility(metadata);
Command c = tu.parseCommand("select * from item where attribute = ('1','2')");
SimpleDBSQLVisitor visitor = new SimpleDBSQLVisitor();
visitor.append(c);
assertEquals("SELECT attribute FROM item WHERE attribute = '1' OR attribute = '2'", visitor.toString());
}
use of org.teiid.translator.simpledb.SimpleDBSQLVisitor in project teiid by teiid.
the class TestSimpleDBSQLVisitor method testEvery.
@Test
public void testEvery() throws Exception {
SimpleDBExecutionFactory translator = new SimpleDBExecutionFactory();
translator.start();
MetadataFactory mf = TestDDLParser.helpParse("create foreign table item (\"itemName()\" integer, attribute string[]);", "y");
TransformationMetadata metadata = RealMetadataFactory.createTransformationMetadata(mf.asMetadataStore(), "x", new FunctionTree("foo", new UDFSource(translator.getPushDownFunctions())));
TranslationUtility tu = new TranslationUtility(metadata);
Command c = tu.parseCommand("select * from item where simpledb.every(attribute) = '1'");
SimpleDBSQLVisitor visitor = new SimpleDBSQLVisitor();
visitor.append(c);
assertEquals("SELECT attribute FROM item WHERE SIMPLEDB.EVERY(attribute) = '1'", visitor.toString());
}
Aggregations