Search in sources :

Example 26 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testTwoExactMatchDifferentDates.

@Test
public void testTwoExactMatchDifferentDates() throws Exception {
    IntrinsicModel m = modelOf("timestamp = '2015-05-10T15:03:10.000Z' and timestamp = '2015-05-11T15:03:10.000Z' and timestamp = '2015-05-11'");
    TestUtils.assertEquals("[]", intervalToString(m.intervals));
    Assert.assertNull(m.filter);
    Assert.assertEquals(IntrinsicValue.FALSE, m.intrinsicValue);
}
Also used : IntrinsicModel(com.questdb.griffin.lexer.model.IntrinsicModel) AbstractCairoTest(com.questdb.cairo.AbstractCairoTest)

Example 27 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testTwoIntervals.

@Test
public void testTwoIntervals() throws Exception {
    IntrinsicModel m = modelOf("bid > 100 and timestamp in (\"2014-01-01T12:30:00.000Z\", \"2014-01-02T12:30:00.000Z\") and timestamp in (\"2014-01-01T16:30:00.000Z\", \"2014-01-05T12:30:00.000Z\")");
    TestUtils.assertEquals("[{lo=2014-01-01T16: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 28 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testManualInterval.

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

Example 29 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testFilterOnIndexedFieldAndInterval.

@Test
public void testFilterOnIndexedFieldAndInterval() throws Exception {
    IntrinsicModel m = modelOf("sym in ('a') and 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));
    TestUtils.assertEquals("sym", m.keyColumn);
    Assert.assertEquals("[a]", m.keyValues.toString());
    Assert.assertNull(m.filter);
}
Also used : IntrinsicModel(com.questdb.griffin.lexer.model.IntrinsicModel) AbstractCairoTest(com.questdb.cairo.AbstractCairoTest)

Example 30 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testIntervalSourceDay.

@Test
public void testIntervalSourceDay() throws Exception {
    IntrinsicModel m = modelOf("timestamp = '2015-02-23T10:00:55.000Z;30m;2d;5'");
    TestUtils.assertEquals("[{lo=2015-02-23T10:00:55.000000Z, hi=2015-02-23T10:30:55.000000Z},{lo=2015-02-25T10:00:55.000000Z, hi=2015-02-25T10:30:55.000000Z},{lo=2015-02-27T10:00:55.000000Z, hi=2015-02-27T10:30:55.000000Z},{lo=2015-03-01T10:00:55.000000Z, hi=2015-03-01T10:30:55.000000Z},{lo=2015-03-03T10:00:55.000000Z, hi=2015-03-03T10:30:55.000000Z}]", intervalToString(m.intervals));
}
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