当前位置: 首页>>代码示例>>Java>>正文


Java ParserException.getMessage方法代码示例

本文整理汇总了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());
    }
}
 
开发者ID:mortardata,项目名称:pig-json,代码行数:18,代码来源:JsonLoader.java

示例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);
        }
    }

}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:21,代码来源:JsFunction.java

示例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); 
    }

}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:14,代码来源:JsFunction.java

示例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());
    }
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:11,代码来源:FixedWidthLoader.java

示例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;
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:30,代码来源:StreamingUDF.java


注:本文中的org.apache.pig.parser.ParserException.getMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。