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

Method registerNoRun

src/org/apache/pig/tools/ToolsPigServer.java:95–129  ·  view source on GitHub ↗

Register a script without running it. This method is not compatible with #registerQuery(String), #registerScript(String), #store(String, String) or #openIterator(String). It can be used with #getPlans() and #runPlan(LogicalPlan, String) in this class

(String fileName,
                              Map<String, String> params,
                              List<String> paramFiles)

Source from the content-addressed store, hash-verified

93 * @throws FrontendException if it encounters problems parsing the script
94 */
95 public void registerNoRun(String fileName,
96 Map<String, String> params,
97 List<String> paramFiles) throws IOException, FrontendException {
98
99 // Do parameter substitution
100 String substituted = null;
101 FileInputStream fis = null;
102 try{
103 fis = new FileInputStream(fileName);
104 substituted = pigContext.doParamSubstitution(fis, paramMapToList(params), paramFiles);
105 }catch (FileNotFoundException e){
106 log.error(e.getLocalizedMessage());
107 throw new IOException(e);
108 } finally {
109 if (fis != null) {
110 fis.close();
111 }
112 }
113
114 // Parse in grunt so that register commands are recognized
115 try {
116 GruntParser grunt = new GruntParser(new StringReader(substituted), this);
117 grunt.setInteractive(false);
118 setBatchOn();
119 //grunt.setLoadOnly(true);
120 grunt.parseOnly();
121 } catch (org.apache.pig.tools.pigscript.parser.ParseException e) {
122 log.error(e.getLocalizedMessage());
123 throw new IOException(e);
124 }
125
126 Graph g = getClonedGraph();
127 LogicalPlan lp = g.getPlan(null);
128 plans = new PigPlans(lp);
129 }
130
131 /**
132 * Get a class containing the Pig plans. For now it just contains

Callers 2

testToolsPigServerMethod · 0.80

Calls 9

setInteractiveMethod · 0.95
parseOnlyMethod · 0.95
getPlanMethod · 0.95
doParamSubstitutionMethod · 0.80
paramMapToListMethod · 0.80
getClonedGraphMethod · 0.80
closeMethod · 0.65
errorMethod · 0.45
setBatchOnMethod · 0.45

Tested by 2

testToolsPigServerMethod · 0.64