public class SqlParserTest extends Object
SqlParserTest is a unit-test for
the SQL parser.
To reuse this test for an extension parser, override the
fixture() method,
calling SqlParserFixture.withConfig(UnaryOperator)
and then SqlParser.Config.withParserFactory(SqlParserImplFactory).
SqlParserFixture,
SqlParserListFixture| 限定符和类型 | 类和说明 |
|---|---|
protected static interface |
SqlParserTest.Tester
Callback to control how test actions are performed.
|
protected static class |
SqlParserTest.TesterImpl
Default implementation of
SqlParserTest.Tester. |
static class |
SqlParserTest.UnparsingTesterImpl
Implementation of
SqlParserTest.Tester which makes sure that the results of
unparsing a query are consistent with the original query. |
| 限定符和类型 | 字段和说明 |
|---|---|
protected static org.apache.calcite.sql.SqlDialect |
BIG_QUERY |
| 构造器和说明 |
|---|
SqlParserTest() |
| 限定符和类型 | 方法和说明 |
|---|---|
protected SqlParserFixture |
expr(String sql) |
SqlParserFixture |
fixture()
Creates the test fixture that determines the behavior of tests.
|
protected SortedSet<String> |
getReservedKeywords() |
static org.hamcrest.Matcher<org.apache.calcite.sql.SqlNode> |
isDdl()
Returns a
Matcher that succeeds if the given SqlNode is a
DDL statement. |
protected boolean |
isReserved(String word)
Returns whether a word is reserved in this parser.
|
protected static SortedSet<String> |
keywords(@Nullable String dialect) |
protected SqlParserFixture |
sql(String sql) |
protected static org.apache.calcite.sql.parser.SqlParser |
sqlParser(Reader source,
UnaryOperator<org.apache.calcite.sql.parser.SqlParser.Config> transform) |
void |
testCaseExpression() |
protected void |
testHoist()
Tests
Hoist. |
protected void |
testMetadata() |
protected void |
testTimeUnitCodes()
Tests that EXTRACT, FLOOR, CEIL, DATE_TRUNC functions accept abbreviations for
time units (such as "Y" for "YEAR") when configured via
SqlParser.Config.timeUnitCodes(). |
protected static String |
varToStr(org.apache.calcite.tools.Hoist.Variable v) |
public SqlParserFixture fixture()
protected SqlParserFixture sql(String sql)
protected SqlParserFixture expr(String sql)
protected static org.apache.calcite.sql.parser.SqlParser sqlParser(Reader source, UnaryOperator<org.apache.calcite.sql.parser.SqlParser.Config> transform)
public static org.hamcrest.Matcher<org.apache.calcite.sql.SqlNode> isDdl()
Matcher that succeeds if the given SqlNode is a
DDL statement.protected boolean isReserved(String word)
@Test public void testCaseExpression()
@Test protected void testTimeUnitCodes()
SqlParser.Config.timeUnitCodes().@Test protected void testMetadata()
@Test protected void testHoist()
Hoist.protected static String varToStr(org.apache.calcite.tools.Hoist.Variable v)
Copyright © 2012-2023 Apache Software Foundation. All Rights Reserved.