Examples of HBqlParser


Examples of org.apache.hadoop.hbase.hbql.antlr.HBqlParser

        }
    }

    public static ExpressionTree parseDescWhereExpr(final String str, final MappingContext sc) throws HBqlException {
        try {
            final HBqlParser parser = ParserUtil.newHBqlParser(str);
            final ExpressionTree expressionTree = parser.descWhereExpr();

            expressionTree.setEmbeddedMapping();

            if (expressionTree.getMappingContext() == null)
                expressionTree.setMappingContext((sc == null) ? new MappingContext() : sc);
View Full Code Here

Examples of org.apache.hadoop.hbase.hbql.antlr.HBqlParser

    public static HBqlParser newHBqlParser(final String sql) throws ParseException {
        try {
            log.debug("Parsing: " + sql);
            final Lexer lex = new HBqlLexer(new ANTLRStringStream(sql));
            final CommonTokenStream tokens = new CommonTokenStream(lex);
            return new HBqlParser(tokens);
        }
        catch (LexerRecognitionException e) {
            throw new ParseException(e.getRecognitionExecption(), e.getMessage());
        }
    }
View Full Code Here

Examples of org.apache.hadoop.hbase.hbql.antlr.HBqlParser

        final Map<String, ExpressionTree> map = mapping.getEvalMap();
        ExpressionTree expressionTree = map.get(str);

        if (expressionTree == null) {
            final HBqlParser parser = ParserUtil.newHBqlParser(str);
            expressionTree = parser.nodescWhereExpr();
            expressionTree.setMappingContext(mappingContext);
            mapping.addToExpressionTreeCache(str, expressionTree);
        }
        else {
            expressionTree.reset();
View Full Code Here

Examples of org.apache.hadoop.hbase.hbql.antlr.HBqlParser

    }


    public static Object parseExpression(final String sql) throws HBqlException {
        try {
            final HBqlParser parser = ParserUtil.newHBqlParser(sql);
            final GenericValue valueExpr = parser.exprValue();
            valueExpr.validateTypes(null, false);
            return valueExpr.getValue(null, null);
        }
        catch (ResultMissingColumnException e) {
            // No column refs should be missing
View Full Code Here

Examples of org.apache.hadoop.hbase.hbql.antlr.HBqlParser

        }
    }

    public static SelectExpressionContext parseSelectElement(final String sql) throws HBqlException {
        try {
            final HBqlParser parser = ParserUtil.newHBqlParser(sql);
            final SelectExpressionContext elem = (SelectExpressionContext)parser.selectElem();
            elem.setMappingContext(null);
            return elem;
        }
        catch (RecognitionException e) {
            e.printStackTrace();
View Full Code Here

Examples of org.apache.hadoop.hbase.hbql.antlr.HBqlParser

        return elem.getValue(null, null);
    }

    public static WithArgs parseWithClause(final String sql) throws ParseException {
        try {
            final HBqlParser parser = ParserUtil.newHBqlParser(sql);
            return parser.withClause();
        }
        catch (RecognitionException e) {
            e.printStackTrace();
            throw new ParseException(e, sql);
        }
View Full Code Here

Examples of org.apache.hadoop.hbase.hbql.antlr.HBqlParser

        }
    }

    public static List<HBqlStatement> parseConsoleStatements(final String sql) throws HBqlException {
        try {
            final HBqlParser parser = ParserUtil.newHBqlParser(sql);
            final List<HBqlStatement> stmts = parser.consoleStatements();
            for (final HBqlStatement stmt : stmts)
                stmt.validate();
            return stmts;
        }
        catch (LexerRecognitionException e) {
View Full Code Here

Examples of org.apache.hadoop.hbase.hbql.antlr.HBqlParser

        }
    }

    public static HBqlStatement parseHBqlStatement(final String sql) throws HBqlException {
        try {
            final HBqlParser parser = ParserUtil.newHBqlParser(sql + ";");
            final HBqlStatement stmt = parser.hbqlStatement();
            stmt.validate();
            return stmt;
        }
        catch (LexerRecognitionException e) {
            throw new ParseException(e.getRecognitionExecption(), sql);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.