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

The following examples show how to use org.apache.hadoop.hive.ql.parse.ParseUtils. 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 File: HiveASTRewriter.java    From incubator-atlas with 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());
        rewrite(tree);
        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
Source File: TestSentryHiveAuthorizationTaskFactory.java    From incubator-sentry with Apache License 2.0 4 votes vote down vote up
private ASTNode parse(String command) throws Exception {
  return ParseUtils.findRootNonNullToken(parseDriver.parse(command));
}