This function is meant to be used if the mappers/reducers want to access any HDFS file @param fileName @return InputStream of the open file. @throws IOException
(String fileName)
| 167 | * @throws IOException |
| 168 | */ |
| 169 | public static InputStream openDFSFile(String fileName) throws IOException { |
| 170 | Configuration conf = PigMapReduce.sJobConfInternal.get(); |
| 171 | if (conf == null) { |
| 172 | throw new RuntimeException( |
| 173 | "can't open DFS file while executing locally"); |
| 174 | } |
| 175 | |
| 176 | return openDFSFile(fileName, ConfigurationUtil.toProperties(conf)); |
| 177 | |
| 178 | } |
| 179 | |
| 180 | public static InputStream openDFSFile(String fileName, Properties properties) throws IOException{ |
| 181 | DataStorage dds = new HDataStorage(properties); |