MCPcopy Create free account
hub / github.com/apache/pig / getPathStrings

Method getPathStrings

src/org/apache/pig/LoadFunc.java:176–212  ·  view source on GitHub ↗

Parse comma separated path strings into a string array. This method escapes commas in the Hadoop glob pattern of the given paths. This method is borrowed from org.apache.hadoop.mapreduce.lib.input.FileInputFormat. A jira (MAPREDUCE-1205) is opened to make the same name method there accessib

(String commaSeparatedPaths)

Source from the content-addressed store, hash-verified

174 * @return an array of path strings
175 */
176 public static String[] getPathStrings(String commaSeparatedPaths) {
177 int length = commaSeparatedPaths.length();
178 int curlyOpen = 0;
179 int pathStart = 0;
180 boolean globPattern = false;
181 List<String> pathStrings = new ArrayList<String>();
182
183 for (int i=0; i<length; i++) {
184 char ch = commaSeparatedPaths.charAt(i);
185 switch(ch) {
186 case '{' : {
187 curlyOpen++;
188 if (!globPattern) {
189 globPattern = true;
190 }
191 break;
192 }
193 case '}' : {
194 curlyOpen--;
195 if (curlyOpen == 0 && globPattern) {
196 globPattern = false;
197 }
198 break;
199 }
200 case ',' : {
201 if (!globPattern) {
202 pathStrings.add(commaSeparatedPaths.substring(pathStart, i));
203 pathStart = i + 1 ;
204 }
205 break;
206 }
207 }
208 }
209 pathStrings.add(commaSeparatedPaths.substring(pathStart, length));
210
211 return pathStrings.toArray(new String[0]);
212 }
213
214 /**
215 * Construct the absolute path from the file location and the current

Callers 7

getInputFileMethod · 0.95
getPathsMethod · 0.95
getAbsolutePathMethod · 0.95
getTotalInputFileSizeMethod · 0.95
hasTooManyInputFilesMethod · 0.95
findMetaFileMethod · 0.95
getInputSizeInBytesMethod · 0.45

Calls 3

lengthMethod · 0.80
toArrayMethod · 0.80
addMethod · 0.65

Tested by 2

getInputFileMethod · 0.76
getInputSizeInBytesMethod · 0.36