Java Code Examples for org.apache.hadoop.hive.ql.parse.ParseUtils

The following examples show how to use org.apache.hadoop.hive.ql.parse.ParseUtils. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: incubator-atlas   Source File:    License: Apache License 2.0 6 votes vote down vote up
public String rewrite(String sourceQry) throws RewriteException {
    String result = sourceQry;
    ASTNode tree = null;
    try {
        ParseDriver pd = new ParseDriver();
        tree = pd.parse(sourceQry, queryContext, true);
        tree = ParseUtils.findRootNonNullToken(tree);
        this.rwCtx = new RewriteContext(sourceQry, tree, queryContext.getTokenRewriteStream());
        result = toSQL();
    } catch (ParseException e) {
       LOG.error("Could not parse the query {} ", sourceQry, e);
        throw new RewriteException("Could not parse query : " , e);
    return result;
Example 2
private ASTNode parse(String command) throws Exception {
  return ParseUtils.findRootNonNullToken(parseDriver.parse(command));