Search in sources :

Example 11 with IntrinsicModel

use of com.questdb.parser.sql.model.IntrinsicModel in project questdb by bluestreak01.

the class QueryFilterAnalyserTest method testIntervalSourceMonth.

@Test
public void testIntervalSourceMonth() throws Exception {
    IntrinsicModel m = modelOf("timestamp = '2015-02-23T10:00:55.000Z;2h;2M;3'");
    final String expected = "[Interval{lo=2015-02-23T10:00:55.000Z, hi=2015-02-23T12:00:55.000Z}," + "Interval{lo=2015-04-23T10:00:55.000Z, hi=2015-04-23T12:00:55.000Z}," + "Interval{lo=2015-06-23T10:00:55.000Z, hi=2015-06-23T12:00:55.000Z}]";
    Assert.assertEquals(expected, IntervalCompiler.asIntervalStr(m.intervals));
}
Also used : IntrinsicModel(com.questdb.parser.sql.model.IntrinsicModel) AbstractTest(com.questdb.test.tools.AbstractTest) Test(org.junit.Test)

Example 12 with IntrinsicModel

use of com.questdb.parser.sql.model.IntrinsicModel in project questdb by bluestreak01.

the class QueryFilterAnalyserTest method testListOfValuesNegativeOverlap.

@Test
public void testListOfValuesNegativeOverlap() throws Exception {
    IntrinsicModel m = modelOf("timestamp in ('2014-01-01T12:30:00.000Z', '2014-01-02T12:30:00.000Z') and sym in ('a', 'z') and sym in ('c')");
    Assert.assertEquals(IntrinsicValue.FALSE, m.intrinsicValue);
}
Also used : IntrinsicModel(com.questdb.parser.sql.model.IntrinsicModel) AbstractTest(com.questdb.test.tools.AbstractTest) Test(org.junit.Test)

Example 13 with IntrinsicModel

use of com.questdb.parser.sql.model.IntrinsicModel in project questdb by bluestreak01.

the class QueryFilterAnalyserTest method testFilterOrInterval.

@Test
public void testFilterOrInterval() throws Exception {
    IntrinsicModel m = modelOf("bid > 100 or timestamp in (\"2014-01-01T12:30:00.000Z\", \"2014-01-02T12:30:00.000Z\")");
    Assert.assertNull(m.intervals);
    assertFilter(m, "\"2014-01-02T12:30:00.000Z\"\"2014-01-01T12:30:00.000Z\"timestampin100bid>or");
}
Also used : IntrinsicModel(com.questdb.parser.sql.model.IntrinsicModel) AbstractTest(com.questdb.test.tools.AbstractTest) Test(org.junit.Test)

Example 14 with IntrinsicModel

use of com.questdb.parser.sql.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'");
    Assert.assertEquals("[]", IntervalCompiler.asIntervalStr(m.intervals));
    Assert.assertNull(m.filter);
    Assert.assertEquals(IntrinsicValue.FALSE, m.intrinsicValue);
}
Also used : IntrinsicModel(com.questdb.parser.sql.model.IntrinsicModel) AbstractTest(com.questdb.test.tools.AbstractTest) Test(org.junit.Test)

Example 15 with IntrinsicModel

use of com.questdb.parser.sql.model.IntrinsicModel in project questdb by bluestreak01.

the class QueryFilterAnalyserTest method testEqualsIndexedSearach.

@Test
public void testEqualsIndexedSearach() throws Exception {
    IntrinsicModel m = modelOf("sym ='X' and bid > 100.05");
    assertFilter(m, "100.05bid>");
    Assert.assertEquals("sym", m.keyColumn);
    Assert.assertEquals("[X]", m.keyValues.toString());
}
Also used : IntrinsicModel(com.questdb.parser.sql.model.IntrinsicModel) AbstractTest(com.questdb.test.tools.AbstractTest) Test(org.junit.Test)

Aggregations

IntrinsicModel (com.questdb.parser.sql.model.IntrinsicModel)70 AbstractTest (com.questdb.test.tools.AbstractTest)69 Test (org.junit.Test)69 ExprNode (com.questdb.parser.sql.model.ExprNode)1