Search in sources :

Example 1 with FlinkSqlParserImpl

use of org.apache.flink.sql.parser.impl.FlinkSqlParserImpl in project flink by apache.

the class TableApiIdentifierParsingTest method createFlinkParser.

private FlinkSqlParserImpl createFlinkParser(String expr) {
    SourceStringReader reader = new SourceStringReader(expr);
    FlinkSqlParserImpl parser = (FlinkSqlParserImpl) FlinkSqlParserImpl.FACTORY.getParser(reader);
    parser.setTabSize(1);
    parser.setUnquotedCasing(Lex.JAVA.unquotedCasing);
    parser.setQuotedCasing(Lex.JAVA.quotedCasing);
    parser.setIdentifierMaxLength(256);
    parser.setConformance(FlinkSqlConformance.DEFAULT);
    parser.switchTo(SqlAbstractParserImpl.LexicalState.BTID);
    return parser;
}
Also used : SourceStringReader(org.apache.calcite.util.SourceStringReader) FlinkSqlParserImpl(org.apache.flink.sql.parser.impl.FlinkSqlParserImpl)

Example 2 with FlinkSqlParserImpl

use of org.apache.flink.sql.parser.impl.FlinkSqlParserImpl in project flink by apache.

the class TableApiIdentifierParsingTest method testTableApiIdentifierParsing.

@Test
public void testTableApiIdentifierParsing() throws ParseException {
    FlinkSqlParserImpl parser = createFlinkParser(stringIdentifier);
    SqlIdentifier sqlIdentifier = parser.TableApiIdentifier();
    assertThat(sqlIdentifier.names, equalTo(expectedParsedIdentifier));
}
Also used : SqlIdentifier(org.apache.calcite.sql.SqlIdentifier) FlinkSqlParserImpl(org.apache.flink.sql.parser.impl.FlinkSqlParserImpl) Test(org.junit.Test)

Aggregations

FlinkSqlParserImpl (org.apache.flink.sql.parser.impl.FlinkSqlParserImpl)2 SqlIdentifier (org.apache.calcite.sql.SqlIdentifier)1 SourceStringReader (org.apache.calcite.util.SourceStringReader)1 Test (org.junit.Test)1