Java Code Examples for org.apache.calcite.sql.parser.SqlParser#configBuilder()

The following examples show how to use org.apache.calcite.sql.parser.SqlParser#configBuilder() . 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: CalciteSqlParser.java    From incubator-pinot with Apache License 2.0 5 votes vote down vote up
private static SqlParser getSqlParser(String sql) {
  // TODO: Check if this can be converted to static or thread local.
  SqlParser.ConfigBuilder parserBuilder = SqlParser.configBuilder();
  parserBuilder.setLex(PINOT_LEX);

  // BABEL is a very liberal conformance value that allows anything supported by any dialect
  parserBuilder.setConformance(SqlConformanceEnum.BABEL);
  parserBuilder.setParserFactory(SqlBabelParserImpl.FACTORY);

  return SqlParser.create(sql, parserBuilder.build());
}
 
Example 2
Source File: CalciteParser.java    From kylin-on-parquet-v2 with Apache License 2.0 4 votes vote down vote up
public static SqlNode parse(String sql) throws SqlParseException {
    SqlParser.ConfigBuilder parserBuilder = SqlParser.configBuilder();
    SqlParser sqlParser = SqlParser.create(sql, parserBuilder.build());
    return sqlParser.parseQuery();
}
 
Example 3
Source File: CalciteParser.java    From kylin with Apache License 2.0 4 votes vote down vote up
public static SqlNode parse(String sql) throws SqlParseException {
    SqlParser.ConfigBuilder parserBuilder = SqlParser.configBuilder();
    SqlParser sqlParser = SqlParser.create(sql, parserBuilder.build());
    return sqlParser.parseQuery();
}
 
Example 4
Source File: CalcitePrepareImpl.java    From calcite with Apache License 2.0 4 votes vote down vote up
/** Factory method for SQL parser configuration. */
protected SqlParser.ConfigBuilder createParserConfig() {
  return SqlParser.configBuilder();
}