SQLToKuduPredicatesTranslator.java 文件源码

java
阅读 15 收藏 0 点赞 0 评论 0

项目:apex-malhar 作者:
public void parseKuduExpression() throws Exception
{
  KuduSQLExpressionLexer lexer = new KuduSQLExpressionLexer(CharStreams.fromString(sqlExpresssion));
  CommonTokenStream tokens = new CommonTokenStream( lexer );
  parser = new KuduSQLParser( tokens );
  errorListener = parser.getKuduSQLExpressionErrorListener();
  ParseTree parserTree = parser.kudusqlexpression();
  if (!errorListener.isSyntaxError()) {
    ParseTreeWalker parseTreeWalker = new ParseTreeWalker();
    kuduSQLParseTreeListener = new KuduSQLParseTreeListener();
    kuduSQLParseTreeListener.setColumnSchemaList(allColumnsForThisTable);
    try {
      parseTreeWalker.walk(kuduSQLParseTreeListener, parserTree);
    } catch (Exception ex) {
      LOG.error(" The supplied SQL expression could not be parsed because " + ex.getMessage(),ex);
      errorListener.setSyntaxError(true);
    }
  } else {
    LOG.error(" Syntax error present in the Kudu SQL expression. Hence not processing");
    List<String> allRegisteredSyntaxErrors = errorListener.getListOfErrorMessages();
    for (String syntaxErrorMessage : allRegisteredSyntaxErrors) {
      LOG.error(" Error : " + syntaxErrorMessage  + " in SQL expression \"" + sqlExpresssion + " \"");
    }
  }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号