@Test public void testCaseWhen() { ParseTree tree = analyzer .parse( "select case when p_type like 'PROMO%' then l_extendedprice * (1 - l_discount) " + "when p_type = 'MOCC' then l_extendedprice - 100 else 0 end as cond from lineitem, part") .getParseTree(); assertEquals(StatementType.SELECT, tree.getType()); QueryBlock block = (QueryBlock) tree; assertTrue(block.getTargetList()[0].hasAlias()); assertEquals("cond", block.getTargetList()[0].getAlias()); assertEquals(DataType.DOUBLE, block.getTargetList()[0].getEvalTree().getValueType()[0]); }
@Test public final void testOnlyExpr() { QueryBlock block = (QueryBlock) analyzer.parse(QUERIES[6]).getParseTree(); EvalNode node = block.getTargetList()[0].getEvalTree(); assertEquals(Type.PLUS, node.getType()); }