本文整理汇总了Java中org.apache.pig.parser.ParserException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java ParserException.getMessage方法的具体用法?Java ParserException.getMessage怎么用?Java ParserException.getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.pig.parser.ParserException
的用法示例。
在下文中一共展示了ParserException.getMessage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getEscapedSchemaFromString
import org.apache.pig.parser.ParserException; //导入方法依赖的package包/类
public static Schema getEscapedSchemaFromString(String schemaStr) {
schemaStr = schemaStr.replaceAll("[\\r\\n]", "");
String[] fieldSchemaStrs = schemaStr.split(",");
StringBuilder escapedSchemaBuilder = new StringBuilder();
for (int i = 0; i < fieldSchemaStrs.length; i++) {
escapedSchemaBuilder.append(escapeFieldSchemaStr(fieldSchemaStrs[i]));
if (i != fieldSchemaStrs.length - 1)
escapedSchemaBuilder.append(",");
}
try {
return Utils.getSchemaFromString(escapedSchemaBuilder.toString());
} catch (ParserException pe) {
throw new IllegalArgumentException("Invalid schema format: " + pe.getMessage());
}
}
示例2: JsFunction
import org.apache.pig.parser.ParserException; //导入方法依赖的package包/类
public JsFunction(String functionName) {
this.jsScriptEngine = JsScriptEngine.getInstance();
this.functionName = functionName;
Object outputSchemaObj = jsScriptEngine.jsEval(this.getClass().getName() + "(String)",
functionName + ".outputSchema");
//if no schema defined, fall back to bytearray
if (outputSchemaObj == null || outputSchemaObj instanceof Undefined) {
this.outputSchema = new Schema(new Schema.FieldSchema(null, DataType.BYTEARRAY));
}
else {
try {
this.outputSchema = Utils.getSchemaFromString(outputSchemaObj.toString());
}
catch (ParserException e) {
throw new IllegalArgumentException(functionName
+ ".outputSchema is not a valid schema: " + e.getMessage(), e);
}
}
}
示例3: JsFunction
import org.apache.pig.parser.ParserException; //导入方法依赖的package包/类
public JsFunction(String functionName) {
this.jsScriptEngine = JsScriptEngine.getInstance();
this.functionName = functionName;
String outputSchemaDef;
outputSchemaDef = jsScriptEngine.jsEval(this.getClass().getName()+"(String)", functionName+".outputSchema").toString();
try {
this.outputSchema = Utils.getSchemaFromString(outputSchemaDef);
} catch (ParserException e) {
throw new IllegalArgumentException(functionName+".outputSchema is not a valid schema: "+e.getMessage(), e);
}
}
示例4: FixedWidthLoader
import org.apache.pig.parser.ParserException; //导入方法依赖的package包/类
public FixedWidthLoader(String columnSpec) {
try {
columns = parseColumnSpec(columnSpec);
String schemaStr = generateDefaultSchemaString();
schema = new ResourceSchema(Utils.getSchemaFromString(schemaStr));
fields = schema.getFields();
} catch (ParserException e) {
throw new IllegalArgumentException("Invalid schema format: " + e.getMessage());
}
}
示例5: StreamingUDF
import org.apache.pig.parser.ParserException; //导入方法依赖的package包/类
public StreamingUDF(String language,
String filePath, String funcName,
String outputSchemaString, String schemaLineNumber,
String execType, String isIllustrate)
throws StreamingUDFOutputSchemaException, ExecException {
this.language = language;
this.filePath = filePath;
this.funcName = funcName;
try {
this.schema = Utils.getSchemaFromString(outputSchemaString);
//ExecTypeProvider.fromString doesn't seem to load the ExecTypes in
//mapreduce mode so we'll try to figure out the exec type ourselves.
if (execType.equals("local")) {
this.execType = ExecType.LOCAL;
} else if (execType.equals("mapreduce")) {
this.execType = ExecType.MAPREDUCE;
} else {
//Not sure what exec type - try to get it from the string.
this.execType = ExecTypeProvider.fromString(execType);
}
} catch (ParserException pe) {
throw new StreamingUDFOutputSchemaException(pe.getMessage(), Integer.valueOf(schemaLineNumber));
} catch (IOException ioe) {
String errorMessage = "Invalid exectype passed to StreamingUDF. Should be local or mapreduce";
log.error(errorMessage, ioe);
throw new ExecException(errorMessage, ioe);
}
this.isIllustrate = isIllustrate;
}