Search in sources :

Example 1 with ParsedModel

use of com.questdb.griffin.lexer.model.ParsedModel in project questdb by bluestreak01.

the class SqlLexerOptimiserTest method assertCreateTable.

private void assertCreateTable(String expected, String ddl, TableModel... tableModels) throws ParserException {
    createModelsAndRun(() -> {
        ParsedModel model = parser.parse(ddl);
        Assert.assertEquals(ParsedModel.CREATE_TABLE, model.getModelType());
        Assert.assertTrue(model instanceof CreateTableModel);
        sink.clear();
        ((CreateTableModel) model).toSink(sink);
        TestUtils.assertEquals(expected, sink);
    }, tableModels);
}
Also used : CreateTableModel(com.questdb.griffin.lexer.model.CreateTableModel) ParsedModel(com.questdb.griffin.lexer.model.ParsedModel)

Example 2 with ParsedModel

use of com.questdb.griffin.lexer.model.ParsedModel in project questdb by bluestreak01.

the class SqlLexerOptimiserTest method assertQuery.

private void assertQuery(String expected, String query, TableModel... tableModels) throws ParserException {
    createModelsAndRun(() -> {
        sink.clear();
        ParsedModel model = parser.parse(query);
        Assert.assertEquals(model.getModelType(), ParsedModel.QUERY);
        ((QueryModel) model).toSink(sink);
        TestUtils.assertEquals(expected, sink);
    }, tableModels);
}
Also used : QueryModel(com.questdb.griffin.lexer.model.QueryModel) ParsedModel(com.questdb.griffin.lexer.model.ParsedModel)

Aggregations

ParsedModel (com.questdb.griffin.lexer.model.ParsedModel)2 CreateTableModel (com.questdb.griffin.lexer.model.CreateTableModel)1 QueryModel (com.questdb.griffin.lexer.model.QueryModel)1