Search in sources :

Example 41 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testLessNonConstant.

@Test
public void testLessNonConstant() throws ParserException {
    IntrinsicModel m = modelOf("timestamp < x");
    Assert.assertNull(m.intervals);
    Assert.assertEquals(IntrinsicValue.UNDEFINED, m.intrinsicValue);
    TestUtils.assertEquals("xtimestamp<", toRpn(m.filter));
}
Also used : IntrinsicModel(com.questdb.griffin.lexer.model.IntrinsicModel) AbstractCairoTest(com.questdb.cairo.AbstractCairoTest)

Example 42 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testThreeIntrinsics2.

@Test
public void testThreeIntrinsics2() throws Exception {
    IntrinsicModel m;
    m = modelOf("ex in ('c') and sym in ('a', 'b') and timestamp in ('2014-01-01T12:30:00.000Z', '2014-01-02T12:30:00.000Z') and bid > 100 and ask < 110");
    assertFilter(m, "110ask<100bid>'c'exinandand");
    TestUtils.assertEquals("sym", m.keyColumn);
    Assert.assertEquals("[a,b]", m.keyValues.toString());
    TestUtils.assertEquals("[{lo=2014-01-01T12:30:00.000000Z, hi=2014-01-02T12:30:00.000000Z}]", intervalToString(m.intervals));
}
Also used : IntrinsicModel(com.questdb.griffin.lexer.model.IntrinsicModel) AbstractCairoTest(com.questdb.cairo.AbstractCairoTest)

Example 43 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testComplexInterval4.

@Test
public void testComplexInterval4() throws Exception {
    IntrinsicModel m = modelOf("timestamp = '2015-02-23T10:00:55.000Z;30m'");
    TestUtils.assertEquals("[{lo=2015-02-23T10:00:55.000000Z, hi=2015-02-23T10:30:55.000000Z}]", intervalToString(m.intervals));
    Assert.assertEquals("IntrinsicModel{keyValues=[], keyColumn='null', filter=null}", m.toString());
}
Also used : IntrinsicModel(com.questdb.griffin.lexer.model.IntrinsicModel) AbstractCairoTest(com.questdb.cairo.AbstractCairoTest)

Example 44 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testIntervalSourceYear.

@Test
public void testIntervalSourceYear() throws Exception {
    IntrinsicModel m = modelOf("timestamp = '2015-02-23T10:00:55.000Z;1d;1y;5'");
    final String expected = "[{lo=2015-02-23T10:00:55.000000Z, hi=2015-02-24T10:00:55.000000Z}," + "{lo=2016-02-23T10:00:55.000000Z, hi=2016-02-24T10:00:55.000000Z}," + "{lo=2017-02-23T10:00:55.000000Z, hi=2017-02-24T10:00:55.000000Z}," + "{lo=2018-02-23T10:00:55.000000Z, hi=2018-02-24T10:00:55.000000Z}," + "{lo=2019-02-23T10:00:55.000000Z, hi=2019-02-24T10:00: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 45 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testComplexInterval5.

@Test
public void testComplexInterval5() throws Exception {
    IntrinsicModel m = modelOf("timestamp = '2015-02-23T10:00:55.000Z;30m' and timestamp != '2015-02-23T10:10:00.000Z'");
    TestUtils.assertEquals("[{lo=2015-02-23T10:00:55.000000Z, hi=2015-02-23T10:09:59.999999Z},{lo=2015-02-23T10:10:00.000001Z, hi=2015-02-23T10:30:55.000000Z}]", intervalToString(m.intervals));
    Assert.assertEquals("IntrinsicModel{keyValues=[], keyColumn='null', filter=null}", m.toString());
}
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