@Test public final void testTypeInferring() { QueryBlock block = (QueryBlock) analyzer.parse("select 1 from alltype where char_col = 'a'").getParseTree(); assertEquals(DataType.CHAR, block.getWhereCondition().getRightExpr().getValueType()[0]); block = (QueryBlock) analyzer.parse("select 1 from alltype where short_col = 1").getParseTree(); assertEquals(DataType.SHORT, block.getWhereCondition().getRightExpr().getValueType()[0]); block = (QueryBlock) analyzer.parse("select 1 from alltype where int_col = 1").getParseTree(); assertEquals(DataType.INT, block.getWhereCondition().getRightExpr().getValueType()[0]); block = (QueryBlock) analyzer.parse("select 1 from alltype where long_col = 1").getParseTree(); assertEquals(DataType.LONG, block.getWhereCondition().getRightExpr().getValueType()[0]); block = (QueryBlock) analyzer.parse("select 1 from alltype where float_col = 1").getParseTree(); assertEquals(DataType.INT, block.getWhereCondition().getRightExpr().getValueType()[0]); block = (QueryBlock) analyzer.parse("select 1 from alltype where float_col = 1.0").getParseTree(); assertEquals(DataType.FLOAT, block.getWhereCondition().getRightExpr().getValueType()[0]); block = (QueryBlock) analyzer.parse("select 1 from alltype where int_col = 1.0").getParseTree(); assertEquals(DataType.DOUBLE, block.getWhereCondition().getRightExpr().getValueType()[0]); block = (QueryBlock) analyzer.parse("select 1 from alltype where double_col = 1.0").getParseTree(); assertEquals(DataType.DOUBLE, block.getWhereCondition().getRightExpr().getValueType()[0]); block = (QueryBlock) analyzer.parse("select 1 from alltype where string_col = 'a'").getParseTree(); assertEquals(DataType.STRING, block.getWhereCondition().getRightExpr().getValueType()[0]); }