public static void initColumns(Table tbl, List<ImportColumnDesc> columnExprs,
                                   Map<String, Pair<String, List<String>>> columnToHadoopFunction)
            throws UserException {
        initColumns(tbl, columnExprs, columnToHadoopFunction, null, null,
                null, null, null, false, false, Lists.newArrayList());
    }
@Test
    public void testInitColumnsColumnInSchemaAndExprArgs() throws UserException {
        table = new OlapTable(1, "test", columns, KeysType.AGG_KEYS,
                new SinglePartitionInfo(), new RandomDistributionInfo(3));

        // columns
        String c0Name = "c0";
        columns.add(new Column(c0Name, Type.INT, true, null, true, null, ""));
        columnExprs.add(new ImportColumnDesc(c0Name, null));

        String c1Name = "c1";
        columns.add(new Column(c1Name, Type.INT, true, null, true, null, ""));
        columnExprs.add(new ImportColumnDesc(c1Name, null));

        String c2Name = "c2";
        columns.add(new Column(c2Name, Type.BITMAP, false, AggregateType.BITMAP_UNION, true, null, ""));
        columnExprs.add(new ImportColumnDesc(c2Name, null));

        String c3Name = "c3";
        columns.add(new Column(c3Name, Type.VARCHAR, false, AggregateType.REPLACE, true, null, ""));
        columnExprs.add(new ImportColumnDesc(c3Name, null));
        String c31Name = "c31";
        columns.add(new Column(c31Name, Type.INT, true, AggregateType.SUM, true, null, ""));

        // column mappings
        // c1 = year(c1)
        List<Expr> params1 = Lists.newArrayList();
        params1.add(new SlotRef(null, c1Name));
        Expr mapping1 = new FunctionCallExpr(FunctionSet.YEAR, params1);
        columnExprs.add(new ImportColumnDesc(c1Name, mapping1));

        // c2 = to_bitmap(c2)
        List<Expr> params2 = Lists.newArrayList();
        params2.add(new SlotRef(null, c2Name));
        Expr mapping2 = new FunctionCallExpr(FunctionSet.TO_BITMAP, params2);
        columnExprs.add(new ImportColumnDesc(c2Name, mapping2));

        // c31 = c3 + 1
        Expr mapping3 = new ArithmeticExpr(ArithmeticExpr.Operator.ADD, new SlotRef(null, c3Name),
                new IntLiteral(1, Type.INT));
        columnExprs.add(new ImportColumnDesc(c31Name, mapping3));

        new Expectations() {
            {
                table.getBaseSchema();
                result = columns;
                table.getColumn(c0Name);
                result = columns.get(0);
                table.getColumn(c1Name);
                result = columns.get(1);
                table.getColumn(c2Name);
                result = columns.get(2);
                table.getColumn(c3Name);
                result = columns.get(3);
                table.getColumn(c31Name);
                result = columns.get(4);
            }
        };

        Load.initColumns(table, columnExprs, null, exprsByName, analyzer, srcTupleDesc,
                slotDescByName, params, true, true, columnsFromPath);

        // check
        System.out.println(slotDescByName);
        Assert.assertEquals(4, slotDescByName.size());
        SlotDescriptor c1SlotDesc = slotDescByName.get(c1Name);
        Assert.assertTrue(c1SlotDesc.getColumn().getType().equals(Type.VARCHAR));
        SlotDescriptor c2SlotDesc = slotDescByName.get(c2Name);
        Assert.assertTrue(c2SlotDesc.getColumn().getType().equals(Type.VARCHAR));
        SlotDescriptor c3SlotDesc = slotDescByName.get(c3Name);
        Assert.assertTrue(c3SlotDesc.getColumn().getType().equals(Type.VARCHAR));
    }