use of org.teiid.cdk.CommandBuilder in project teiid by teiid.
the class TestHiveExecutionFactory method testStringLiteral.
@Test
public void testStringLiteral() {
CommandBuilder commandBuilder = new CommandBuilder(RealMetadataFactory.example1Cached());
Command obj = commandBuilder.getCommand("select pm1.g1.e2 from pm1.g1 where pm1.g1.e1 = 'a''b\\c'");
SQLConversionVisitor sqlVisitor = hiveTranslator.getSQLConversionVisitor();
sqlVisitor.append(obj);
assertEquals("SELECT g1.e2 FROM g1 WHERE g1.e1 = 'a\\'b\\\\c'", sqlVisitor.toString());
}
use of org.teiid.cdk.CommandBuilder in project teiid by teiid.
the class TestImpalaExecutionFactory method testStringLiteral.
@Test
public void testStringLiteral() {
CommandBuilder commandBuilder = new CommandBuilder(RealMetadataFactory.example1Cached());
Command obj = commandBuilder.getCommand("select pm1.g1.e2 from pm1.g1 where pm1.g1.e1 = 'a''b\\c'");
SQLConversionVisitor sqlVisitor = impalaTranslator.getSQLConversionVisitor();
sqlVisitor.append(obj);
assertEquals("SELECT g1.e2 FROM g1 WHERE g1.e1 = 'a\\'b\\\\c'", sqlVisitor.toString());
}
use of org.teiid.cdk.CommandBuilder in project teiid by teiid.
the class TestImpalaExecutionFactory method testJoin.
@Test
public void testJoin() {
CommandBuilder commandBuilder = new CommandBuilder(RealMetadataFactory.example1Cached());
Command obj = commandBuilder.getCommand("select pm1.g1.e1 from pm1.g1 inner join pm1.g2 inner join pm1.g3 on pm1.g2.e2 = pm1.g3.e2 on pm1.g1.e1 = pm1.g2.e1");
SQLConversionVisitor sqlVisitor = impalaTranslator.getSQLConversionVisitor();
sqlVisitor.append(obj);
assertEquals("SELECT g1.e1 FROM g2 JOIN g3 ON g2.e2 = g3.e2 JOIN g1 ON g1.e1 = g2.e1", sqlVisitor.toString());
}
use of org.teiid.cdk.CommandBuilder in project teiid by teiid.
the class TestImpalaExecutionFactory method testLikeRegex.
@Test
public void testLikeRegex() {
CommandBuilder commandBuilder = new CommandBuilder(RealMetadataFactory.exampleBQTCached());
Select obj = (Select) commandBuilder.getCommand("SELECT max(StringNum) as a FROM bqt1.SmallA where stringkey like_regex '^[1-9]$'");
SQLConversionVisitor sqlVisitor = impalaTranslator.getSQLConversionVisitor();
sqlVisitor.append(obj);
assertEquals("SELECT MAX(SmallA.StringNum) AS a FROM SmallA WHERE SmallA.StringKey REGEXP '^[1-9]$'", sqlVisitor.toString());
}
Aggregations