@Test
public void testSchema() throws Exception {

    // No type
    Over func = new Over();
    Schema in = Schema.generateNestedSchema(DataType.BAG, DataType.INTEGER);
    Schema out = func.outputSchema(in);
    assertEquals("{{NULL}}", out.toString());
    // chararray
    func = new Over("chararray");
    in = Schema.generateNestedSchema(DataType.BAG, DataType.INTEGER);
    out = func.outputSchema(in);
    assertEquals("{org.apache.pig.piggybank.evaluation.over_1: {result: chararray}}", out.toString());
    // int
    func = new Over("Int");
    in = Schema.generateNestedSchema(DataType.BAG, DataType.INTEGER);
    out = func.outputSchema(in);
    assertEquals("{org.apache.pig.piggybank.evaluation.over_2: {result: int}}", out.toString());
    // double
    func = new Over("DOUBLE");
    in = Schema.generateNestedSchema(DataType.BAG, DataType.INTEGER);
    out = func.outputSchema(in);
    assertEquals("{org.apache.pig.piggybank.evaluation.over_3: {result: double}}", out.toString());
    // bigdecimal
    func = new Over("BIGDECIMAL");
    in = Schema.generateNestedSchema(DataType.BAG, DataType.INTEGER);
    out = func.outputSchema(in);
    assertEquals("{org.apache.pig.piggybank.evaluation.over_4: {result: bigdecimal}}", out.toString());
    
    // named 
    func = new Over("bob:chararray");
    in = Schema.generateNestedSchema(DataType.BAG, DataType.INTEGER);
    out = func.outputSchema(in);
    assertEquals("{org.apache.pig.piggybank.evaluation.over_5: {bob: chararray}}", out.toString());
    
    
    // Search inner alias and type
    func = new Over("true");
    in = Schema.generateNestedSchema(DataType.BAG, DataType.BIGDECIMAL);
    in.getField(0).schema.getField(0).alias="test";
    out = func.outputSchema(in);
    assertEquals("{org.apache.pig.piggybank.evaluation.over_6: {test_over: bigdecimal}}", out.toString());
}