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

Method copyFromLocalToCluster

test/org/apache/pig/test/Util.java:688–707  ·  view source on GitHub ↗

Utility method to copy a file form local filesystem to the dfs on the minicluster for testing in mapreduce mode @param cluster a reference to the minicluster @param localFileName the pathname of local file @param fileNameOnCluster the name with which the file should be created on the minicluster @th

(MiniGenericCluster cluster,
        String localFileName, String fileNameOnCluster)

Source from the content-addressed store, hash-verified

686 * @throws IOException
687 */
688 static public void copyFromLocalToCluster(MiniGenericCluster cluster,
689 String localFileName, String fileNameOnCluster) throws IOException {
690 if(Util.WINDOWS){
691 if (!localFileName.contains(":")) {
692 localFileName = localFileName.replace('\\','/');
693 } else {
694 localFileName = localFileName.replace('/','\\');
695 }
696 fileNameOnCluster = fileNameOnCluster.replace('\\','/');
697 }
698 PigServer ps = new PigServer(cluster.getExecType(), cluster.getProperties());
699 String script = getFSMkDirCommand(fileNameOnCluster) + "fs -put " + localFileName + " " + fileNameOnCluster;
700 GruntParser parser = new GruntParser(new StringReader(script), ps);
701 parser.setInteractive(false);
702 try {
703 parser.parseStopOnError();
704 } catch (org.apache.pig.tools.pigscript.parser.ParseException e) {
705 throw new IOException(e);
706 }
707 }
708
709 static public void copyFromLocalToLocal(String fromLocalFileName,
710 String toLocalFileName) throws IOException {

Calls 7

getFSMkDirCommandMethod · 0.95
setInteractiveMethod · 0.95
parseStopOnErrorMethod · 0.95
replaceMethod · 0.65
containsMethod · 0.45
getExecTypeMethod · 0.45
getPropertiesMethod · 0.45

Tested by

no test coverage detected