Search in sources :

Example 1 with FilterLexer

use of org.apache.hadoop.hive.metastore.parser.FilterLexer in project hive by apache.

the class PartFilterExprUtil method getFilterParser.

public static FilterParser getFilterParser(String filter) throws MetaException {
    FilterLexer lexer = new FilterLexer(new ANTLRNoCaseStringStream(filter));
    CommonTokenStream tokens = new CommonTokenStream(lexer);
    FilterParser parser = new FilterParser(tokens);
    try {
        parser.filter();
    } catch (RecognitionException re) {
        throw new MetaException("Error parsing partition filter; lexer error: " + lexer.errorMsg + "; exception " + re);
    }
    if (lexer.errorMsg != null) {
        throw new MetaException("Error parsing partition filter : " + lexer.errorMsg);
    }
    return parser;
}
Also used : CommonTokenStream(org.antlr.runtime.CommonTokenStream) FilterParser(org.apache.hadoop.hive.metastore.parser.FilterParser) RecognitionException(org.antlr.runtime.RecognitionException) FilterLexer(org.apache.hadoop.hive.metastore.parser.FilterLexer) ANTLRNoCaseStringStream(org.apache.hadoop.hive.metastore.parser.ExpressionTree.ANTLRNoCaseStringStream) MetaException(org.apache.hadoop.hive.metastore.api.MetaException)

Aggregations

CommonTokenStream (org.antlr.runtime.CommonTokenStream)1 RecognitionException (org.antlr.runtime.RecognitionException)1 MetaException (org.apache.hadoop.hive.metastore.api.MetaException)1 ANTLRNoCaseStringStream (org.apache.hadoop.hive.metastore.parser.ExpressionTree.ANTLRNoCaseStringStream)1 FilterLexer (org.apache.hadoop.hive.metastore.parser.FilterLexer)1 FilterParser (org.apache.hadoop.hive.metastore.parser.FilterParser)1