Search in sources :

Example 1 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testInNull.

@Test
public void testInNull() throws Exception {
    IntrinsicModel m = modelOf("sym in ('X', null, 'Y')");
    TestUtils.assertEquals("sym", m.keyColumn);
    Assert.assertEquals("[X,null,Y]", m.keyValues.toString());
}
Also used : IntrinsicModel(com.questdb.griffin.lexer.model.IntrinsicModel) AbstractCairoTest(com.questdb.cairo.AbstractCairoTest)

Example 2 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testNoIntrinsics.

@Test
public void testNoIntrinsics() throws Exception {
    IntrinsicModel m = modelOf("a > 10 or b > 20");
    Assert.assertNull(m.intervals);
    Assert.assertNull(m.keyColumn);
    assertFilter(m, "20b>10a>or");
}
Also used : IntrinsicModel(com.questdb.griffin.lexer.model.IntrinsicModel) AbstractCairoTest(com.questdb.cairo.AbstractCairoTest)

Example 3 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testEqualsOverlapWithIn2.

@Test
public void testEqualsOverlapWithIn2() throws Exception {
    IntrinsicModel m = modelOf("sym = 'y' and sym in ('x','y')");
    Assert.assertNull(m.filter);
    Assert.assertEquals("[y]", m.keyValues.toString());
}
Also used : IntrinsicModel(com.questdb.griffin.lexer.model.IntrinsicModel) AbstractCairoTest(com.questdb.cairo.AbstractCairoTest)

Example 4 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testIntervalSourceHour.

@Test
public void testIntervalSourceHour() throws Exception {
    IntrinsicModel m = modelOf("timestamp = '2015-02-23T10:00:55.000Z;10m;3h;10'");
    final String expected = "[{lo=2015-02-23T10:00:55.000000Z, hi=2015-02-23T10:10:55.000000Z}," + "{lo=2015-02-23T13:00:55.000000Z, hi=2015-02-23T13:10:55.000000Z}," + "{lo=2015-02-23T16:00:55.000000Z, hi=2015-02-23T16:10:55.000000Z}," + "{lo=2015-02-23T19:00:55.000000Z, hi=2015-02-23T19:10:55.000000Z}," + "{lo=2015-02-23T22:00:55.000000Z, hi=2015-02-23T22:10:55.000000Z}," + "{lo=2015-02-24T01:00:55.000000Z, hi=2015-02-24T01:10:55.000000Z}," + "{lo=2015-02-24T04:00:55.000000Z, hi=2015-02-24T04:10:55.000000Z}," + "{lo=2015-02-24T07:00:55.000000Z, hi=2015-02-24T07:10:55.000000Z}," + "{lo=2015-02-24T10:00:55.000000Z, hi=2015-02-24T10:10:55.000000Z}," + "{lo=2015-02-24T13:00:55.000000Z, hi=2015-02-24T13:10:55.000000Z}]";
    TestUtils.assertEquals(expected, intervalToString(m.intervals));
}
Also used : IntrinsicModel(com.questdb.griffin.lexer.model.IntrinsicModel) GriffinParserTestUtils.intervalToString(com.questdb.griffin.lexer.GriffinParserTestUtils.intervalToString) AbstractCairoTest(com.questdb.cairo.AbstractCairoTest)

Example 5 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testLambdaVsLambda.

@Test
public void testLambdaVsLambda() throws Exception {
    IntrinsicModel m = modelOf("ex in (`abc`) and sym in (`xyz`)");
    TestUtils.assertEquals("sym", m.keyColumn);
    Assert.assertEquals(1, m.keyValues.size());
    TestUtils.assertEquals("xyz", m.keyValues.get(0));
    Assert.assertTrue(m.keyValuesIsLambda);
    Assert.assertNotNull(m.filter);
    Assert.assertEquals("ex`abc`in", GriffinParserTestUtils.toRpn(m.filter));
}
Also used : IntrinsicModel(com.questdb.griffin.lexer.model.IntrinsicModel) AbstractCairoTest(com.questdb.cairo.AbstractCairoTest)

Aggregations

IntrinsicModel (com.questdb.griffin.lexer.model.IntrinsicModel)86 AbstractCairoTest (com.questdb.cairo.AbstractCairoTest)85 GriffinParserTestUtils.intervalToString (com.questdb.griffin.lexer.GriffinParserTestUtils.intervalToString)5 ExprNode (com.questdb.griffin.common.ExprNode)1