use of org.teiid.translator.jdbc.hana.Log10FunctionModifier in project teiid by teiid.
the class TestLog10FunctionModifier method testModifier.
public void testModifier() {
Literal arg = LANG_FACTORY.createLiteral(new Double(5.2), Double.class);
// $NON-NLS-1$
Function func = LANG_FACTORY.createFunction("log10", Arrays.asList(arg), Double.class);
Log10FunctionModifier modifier = new Log10FunctionModifier(LANG_FACTORY);
modifier.translate(func);
// $NON-NLS-1$
assertEquals("log", func.getName());
assertEquals(Double.class, func.getType());
List<Expression> outArgs = func.getParameters();
assertEquals(2, outArgs.size());
assertEquals(arg, outArgs.get(1));
assertTrue(outArgs.get(1) instanceof Literal);
Literal newArg = (Literal) outArgs.get(0);
assertEquals(Integer.class, newArg.getType());
assertEquals(new Integer(10), newArg.getValue());
// $NON-NLS-1$
assertEquals("log(10, 5.2)", SQLStringVisitor.getSQLString(func));
}
Aggregations