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

Class PigMacro

src/org/apache/pig/parser/PigMacro.java:45–501  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43import org.apache.pig.tools.parameters.PreprocessorContext;
44
45class PigMacro {
46
47 private static final Log LOG = LogFactory.getLog(PigMacro.class);
48
49 private String fileName;
50 private String name;
51 private String body;
52 private List<String> params;
53 private List<String> rets;
54 private Map<String, PigMacro> seen;
55 private Set<String> macroStack;
56 private PigContext pigContext;
57 private long idx = 0;
58
59 // The start line number of this macro in the script
60 private int startLine = 0;
61
62 PigMacro(String name, String file, List<String> params,
63 List<String> returns, String body, Map<String, PigMacro> seen) {
64 this.name = name;
65 this.params = (params == null) ? new ArrayList<String>() : params;
66 this.rets = (returns == null) ? new ArrayList<String>() : returns;
67 this.fileName = file;
68 this.body = body;
69 this.seen = seen;
70 this.macroStack = new HashSet<String>();
71 LOG.debug("Macro '" + name + "' is defined");
72 }
73
74 String getName() { return name; }
75
76 void setStack(Set<String> stack) {
77 macroStack = stack;
78 }
79
80 Set<String> getStack() { return macroStack; }
81
82 void setStartLine(int start) {
83 this.startLine = start;
84 }
85
86 int getStartLine() {
87 return startLine;
88 }
89
90 void setPigContext(PigContext pigContext) {
91 this.pigContext = pigContext;
92 }
93
94 private CommonTree inline(String[] inputs, String[] outputs, CommonTree t,
95 String file) throws ParserException {
96 String in = substituteParams(inputs, outputs, t.getLine(), file);
97
98 Set<String> masks = new HashSet<String>();
99 if (inputs != null) {
100 for (String s : inputs) {
101 masks.add(s);
102 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected