1
当编写一个UDF比方说,一个EvalFunc,是否有可能通过与加载外部属性文件中UDF
properties = new Properties();
properties.load(new FileInputStream("conf/config.properties"));
在Hadoop的模式下运行时
一个配置文件?
最佳, 威尔
当编写一个UDF比方说,一个EvalFunc,是否有可能通过与加载外部属性文件中UDF
properties = new Properties();
properties.load(new FileInputStream("conf/config.properties"));
在Hadoop的模式下运行时
一个配置文件?
最佳, 威尔
这里是Simple Example to Read and Write files from Hadoop DFS
从http://wiki.apache.org/hadoop/HadoopDfsReadWriteExample
也许你可以找到它的一些有用的代码来完成你的工作。
以下是我的代码,它成功地加载性能在Hadoop中的文件,我用Apache Commons Configuration
http://commons.apache.org/configuration/
public static void loadProperites(String path) throws ConfigurationException, IOException {
Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(conf);
Path inFile = new Path(path);
FSDataInputStream in = fs.open(inFile);
PropertiesConfiguration config = new PropertiesConfiguration();
config.load(in);
in.close();
}