Search in sources :

Example 1 with QueryModel

use of com.questdb.griffin.lexer.model.QueryModel 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)

Example 2 with QueryModel

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

the class SqlLexerOptimiserTest method testTooManyColumnsEdgeInOrderBy.

@Test
public void testTooManyColumnsEdgeInOrderBy() throws Exception {
    try (TableModel model = new TableModel(configuration, "x", PartitionBy.NONE)) {
        for (int i = 0; i < SqlLexerOptimiser.MAX_ORDER_BY_COLUMNS - 1; i++) {
            model.col("f" + i, ColumnType.INT);
        }
        CairoTestUtils.create(model);
    }
    StringBuilder b = new StringBuilder();
    b.append("x order by ");
    for (int i = 0; i < SqlLexerOptimiser.MAX_ORDER_BY_COLUMNS - 1; i++) {
        if (i > 0) {
            b.append(',');
        }
        b.append('f').append(i);
    }
    QueryModel st = (QueryModel) parser.parse(b);
    Assert.assertEquals(SqlLexerOptimiser.MAX_ORDER_BY_COLUMNS - 1, st.getOrderBy().size());
}
Also used : QueryModel(com.questdb.griffin.lexer.model.QueryModel) CreateTableModel(com.questdb.griffin.lexer.model.CreateTableModel) Test(org.junit.Test)

Example 3 with QueryModel

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

the class QueryCompiler method compile.

private RecordCursorFactory compile(ParsedModel model) {
    if (model.getModelType() == ParsedModel.QUERY) {
        clearState();
        final QueryModel qm = (QueryModel) model;
        // rs.setParameterMap(EMPTY_PARAMS);
        return null;
    }
    throw new IllegalArgumentException("QueryModel expected");
}
Also used : QueryModel(com.questdb.griffin.lexer.model.QueryModel)

Aggregations

QueryModel (com.questdb.griffin.lexer.model.QueryModel)3 CreateTableModel (com.questdb.griffin.lexer.model.CreateTableModel)1 ParsedModel (com.questdb.griffin.lexer.model.ParsedModel)1 Test (org.junit.Test)1