### Question:
SqlToJavaVisitor { public String process(final Expression expression) { return formatExpression(expression); } SqlToJavaVisitor(Schema schema, FunctionRegistry functionRegistry); String process(final Expression expression);  }### Answer:
@Test public void processBasicJavaMath() throws Exception { String simpleQuery = "SELECT col0+col3, col2, col3+10, col0*25, 12*4+2 FROM test1 WHERE col0 > 100;"; Analysis analysis = analyzeQuery(simpleQuery); String javaExpression = new SqlToJavaVisitor(schema, functionRegistry) .process(analysis.getSelectExpressions().get(0)); assertThat(javaExpression, equalTo("(TEST1_COL0 + TEST1_COL3)")); }
@Test public void shouldCreateCorrectCastJavaExpression() throws Exception { String simpleQuery = "SELECT cast(col0 AS INTEGER), cast(col3 as BIGINT), cast(col3 as " + "varchar) FROM " + "test1 WHERE " + "col0 > 100;"; Analysis analysis = analyzeQuery(simpleQuery); String javaExpression0 = new SqlToJavaVisitor(schema, functionRegistry) .process(analysis.getSelectExpressions().get(0)); String javaExpression1 = new SqlToJavaVisitor(schema, functionRegistry) .process(analysis.getSelectExpressions().get(1)); String javaExpression2 = new SqlToJavaVisitor(schema, functionRegistry) .process(analysis.getSelectExpressions().get(2)); assertThat(javaExpression0, equalTo("(new Long(TEST1_COL0).intValue())")); assertThat(javaExpression1, equalTo("(new Double(TEST1_COL3).longValue())")); assertThat(javaExpression2, equalTo("String.valueOf(TEST1_COL3)")); }