StringWriter writer = new StringWriter();
BufferedReader in = new BufferedReader(new StringReader(qstr));
String[] type1 = new String[1];
try {
psp.genSubstitutedFile(in, writer, plist.toArray(params),
scriptContext.getPigContext().getParamFiles()!=null &&
scriptContext.getPigContext().getParamFiles().size() > 0 ?
scriptContext.getPigContext().getParamFiles().toArray(type1) : null);
} catch (org.apache.pig.tools.parameters.ParseException e) {
throw new IOException("Param substitution failed", e);