Search in sources :

Example 6 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testMultipleAnds.

@Test
public void testMultipleAnds() throws Exception {
    IntrinsicModel m = modelOf("a > 10 and b > 20 and (c > 100 and d < 20 and bid = 30)");
    assertFilter(m, "30bid=20d<100c>andand20b>10a>andand");
}
Also used : IntrinsicModel(com.questdb.griffin.lexer.model.IntrinsicModel) AbstractCairoTest(com.questdb.cairo.AbstractCairoTest)

Example 7 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testNotInIntervalIntersect2.

@Test
public void testNotInIntervalIntersect2() throws Exception {
    IntrinsicModel m = modelOf("timestamp = '2015-05-11' and not (timestamp in  ('2015-05-11T15:00:00.000Z', '2015-05-11T20:00:00.000Z'))");
    Assert.assertEquals(IntrinsicValue.UNDEFINED, m.intrinsicValue);
    TestUtils.assertEquals("[{lo=2015-05-11T00:00:00.000000Z, hi=2015-05-11T14:59:59.999999Z},{lo=2015-05-11T20:00:00.000001Z, hi=2015-05-11T23:59:59.999999Z}]", intervalToString(m.intervals));
    Assert.assertNull(m.filter);
}
Also used : IntrinsicModel(com.questdb.griffin.lexer.model.IntrinsicModel) AbstractCairoTest(com.questdb.cairo.AbstractCairoTest)

Example 8 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testEqualsIndexedSearch.

@Test
public void testEqualsIndexedSearch() throws Exception {
    IntrinsicModel m = modelOf("sym ='X' and bid > 100.05");
    assertFilter(m, "100.05bid>");
    TestUtils.assertEquals("sym", m.keyColumn);
    Assert.assertEquals("[X]", m.keyValues.toString());
}
Also used : IntrinsicModel(com.questdb.griffin.lexer.model.IntrinsicModel) AbstractCairoTest(com.questdb.cairo.AbstractCairoTest)

Example 9 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testConstVsLambda.

@Test
public void testConstVsLambda() throws Exception {
    IntrinsicModel m = modelOf("ex in (1,2) 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("ex12in", GriffinParserTestUtils.toRpn(m.filter));
}
Also used : IntrinsicModel(com.questdb.griffin.lexer.model.IntrinsicModel) AbstractCairoTest(com.questdb.cairo.AbstractCairoTest)

Example 10 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testEqualsOverlapWithIn3.

@Test
public void testEqualsOverlapWithIn3() throws Exception {
    IntrinsicModel m = modelOf("sym in ('x','y') and sym = 'y'", "ex");
    TestUtils.assertEquals("'y'sym='y''x'syminand", toRpn(m.filter));
    Assert.assertEquals("[]", m.keyValues.toString());
    Assert.assertEquals("[]", m.keyValuePositions.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