@Value.Enclosing public class SqlParser extends Object
SqlParser parses a SQL statement.| Modifier and Type | Class and Description |
|---|---|
static interface |
SqlParser.Config
Interface to define the configuration for a SQL parser.
|
static class |
SqlParser.ConfigBuilder
Deprecated.
|
| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEFAULT_ALLOW_BANG_EQUAL
Deprecated.
|
static int |
DEFAULT_IDENTIFIER_MAX_LENGTH |
static com.google.common.collect.ImmutableMap<String,org.apache.calcite.avatica.util.TimeUnit> |
DEFAULT_IDENTIFIER_TIMEUNIT_MAP
Default value of
SqlParser.Config.timeUnitCodes(). |
| Modifier and Type | Method and Description |
|---|---|
static SqlParser.Config |
config()
Returns a default
SqlParser.Config. |
static SqlParser.ConfigBuilder |
configBuilder()
Deprecated.
Use
config() |
static SqlParser.ConfigBuilder |
configBuilder(SqlParser.Config config)
Deprecated.
Use
config, and modify it using its mutator methods |
static SqlParser |
create(Reader reader,
SqlParser.Config config)
Creates a
SqlParser to parse the given string using the
parser implementation created from given SqlParserImplFactory
with given quoting syntax and casing policies for identifiers. |
static SqlParser |
create(String s)
Creates a
SqlParser to parse the given string using
Calcite's parser implementation. |
static SqlParser |
create(String sql,
SqlParser.Config config)
Creates a
SqlParser to parse the given string using the
parser implementation created from given SqlParserImplFactory
with given quoting syntax and casing policies for identifiers. |
org.apache.calcite.sql.parser.SqlAbstractParserImpl.Metadata |
getMetadata()
Get the parser metadata.
|
List<CalciteContextException> |
getWarnings()
Returns the warnings that were generated by the previous invocation
of the parser.
|
SqlNode |
parseExpression()
Parses a SQL expression.
|
SqlNode |
parseQuery()
Parses a
SELECT statement. |
SqlNode |
parseQuery(String sql)
Parses a
SELECT statement and reuses parser. |
SqlNode |
parseStmt()
Parses an SQL statement.
|
SqlNodeList |
parseStmtList()
Parses a list of SQL statements separated by semicolon.
|
public static final int DEFAULT_IDENTIFIER_MAX_LENGTH
public static final com.google.common.collect.ImmutableMap<String,org.apache.calcite.avatica.util.TimeUnit> DEFAULT_IDENTIFIER_TIMEUNIT_MAP
SqlParser.Config.timeUnitCodes().
The map is empty, which means that there are no abbreviations other than
the time unit names ("YEAR", "SECOND", etc.)@Deprecated public static final boolean DEFAULT_ALLOW_BANG_EQUAL
public static SqlParser create(String s)
SqlParser to parse the given string using
Calcite's parser implementation.
The default lexical policy is similar to Oracle.
s - An SQL statement or expression to parse.Lex.ORACLEpublic static SqlParser create(String sql, SqlParser.Config config)
SqlParser to parse the given string using the
parser implementation created from given SqlParserImplFactory
with given quoting syntax and casing policies for identifiers.sql - A SQL statement or expression to parseconfig - The parser configuration (identifier max length, etc.)public static SqlParser create(Reader reader, SqlParser.Config config)
SqlParser to parse the given string using the
parser implementation created from given SqlParserImplFactory
with given quoting syntax and casing policies for identifiers.
Unlike
create(java.lang.String, org.apache.calcite.sql.parser.SqlParser.Config),
the parser is not able to return the original query string, but will
instead return "?".
reader - The source for the SQL statement or expression to parseconfig - The parser configuration (identifier max length, etc.)public SqlNode parseExpression() throws SqlParseException
SqlParseException - if there is a parse errorpublic SqlNode parseQuery() throws SqlParseException
SELECT statement.SqlSelect for a regular
SELECT statement; a SqlBinaryOperator
for a UNION, INTERSECT, or EXCEPT.SqlParseException - if there is a parse errorpublic SqlNode parseQuery(String sql) throws SqlParseException
SELECT statement and reuses parser.sql - sql to parseSqlSelect for a regular
SELECT statement; a SqlBinaryOperator
for a UNION, INTERSECT, or EXCEPT.SqlParseException - if there is a parse errorpublic SqlNode parseStmt() throws SqlParseException
SqlParseException - if there is a parse errorpublic SqlNodeList parseStmtList() throws SqlParseException
SqlParseException - if there is a parse errorpublic org.apache.calcite.sql.parser.SqlAbstractParserImpl.Metadata getMetadata()
SqlAbstractParserImpl.Metadata implementation of
underlying parser.public List<CalciteContextException> getWarnings()
public static SqlParser.Config config()
SqlParser.Config.@Deprecated public static SqlParser.ConfigBuilder configBuilder()
config()SqlParser.Config.@Deprecated public static SqlParser.ConfigBuilder configBuilder(SqlParser.Config config)
config, and modify it using its mutator methodsSqlParser.Config that starts with an existing Config.Copyright © 2012-2022 Apache Software Foundation. All Rights Reserved.