Search in sources :

Example 11 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testIntervalGreater3.

@Test
public void testIntervalGreater3() throws Exception {
    IntrinsicModel m = modelOf("timestamp in ('2014-01-01T12:30:00.000Z', '2014-01-02T12:30:00.000Z') and timestamp > x()");
    TestUtils.assertEquals("[{lo=2014-01-01T12:30:00.000000Z, hi=2014-01-02T12:30:00.000000Z}]", intervalToString(m.intervals));
    TestUtils.assertEquals("xtimestamp>", toRpn(m.filter));
}
Also used : IntrinsicModel(com.questdb.griffin.lexer.model.IntrinsicModel) AbstractCairoTest(com.questdb.cairo.AbstractCairoTest)

Example 12 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testSimpleInterval.

@Test
public void testSimpleInterval() throws Exception {
    IntrinsicModel m = modelOf("timestamp in (\"2014-01-01T12:30:00.000Z\", \"2014-01-02T12:30:00.000Z\")");
    TestUtils.assertEquals("[{lo=2014-01-01T12:30:00.000000Z, hi=2014-01-02T12:30:00.000000Z}]", intervalToString(m.intervals));
    Assert.assertNull(m.filter);
}
Also used : IntrinsicModel(com.questdb.griffin.lexer.model.IntrinsicModel) AbstractCairoTest(com.questdb.cairo.AbstractCairoTest)

Example 13 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testIntervalGreaterOrEq1.

@Test
public void testIntervalGreaterOrEq1() throws Exception {
    IntrinsicModel m = modelOf("timestamp in ('2014-01-01T12:30:00.000Z', '2014-01-02T12:30:00.000Z') and timestamp >= '2014-01-01T15:30:00.000Z'");
    TestUtils.assertEquals("[{lo=2014-01-01T15: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 14 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testLiteralInInterval.

@Test
public void testLiteralInInterval() throws Exception {
    IntrinsicModel m = modelOf("timestamp in (\"2014-01-01T12:30:00.000Z\", c)");
    Assert.assertNull(m.intervals);
    assertFilter(m, "c\"2014-01-01T12:30:00.000Z\"timestampin");
}
Also used : IntrinsicModel(com.questdb.griffin.lexer.model.IntrinsicModel) AbstractCairoTest(com.questdb.cairo.AbstractCairoTest)

Example 15 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testComplexInterval3.

@Test
public void testComplexInterval3() throws Exception {
    IntrinsicModel m = modelOf("timestamp = '2015-02-23T10:00:55.000Z;15s'");
    TestUtils.assertEquals("[{lo=2015-02-23T10:00:55.000000Z, hi=2015-02-23T10:01:10.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