package com.hadoopexpert;
import java.io.IOException;
import org.apache.pig.EvalFunc;
import org.apache.pig.data.Tuple;
public class upper extends EvalFunc<String>
{
public String exec(Tuple input) throws IOException {
if (input == null || input.size() == 0)
return null;
try{
String str = (String)input.get(0);
return str.toUpperCase(); }catch(Exception e){
throw new IOException("Caught exception processing input row ", e);
} }
}
我想将下面 i/p 文件的第二列转换为大写,这是正确的代码吗?输入文件 - 101、ahmed 102、kranthi 103、sagar 104、mamtha