Search in sources :

Example 31 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testListOfValuesOverlapWithNotClause2.

@Test
public void testListOfValuesOverlapWithNotClause2() 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 not (sym in ('a', 'd', 'e'))");
    Assert.assertNull(m.filter);
    Assert.assertEquals("[z]", m.keyValues.toString());
    Assert.assertEquals(IntrinsicValue.UNDEFINED, m.intrinsicValue);
}
Also used : IntrinsicModel(com.questdb.griffin.lexer.model.IntrinsicModel) AbstractCairoTest(com.questdb.cairo.AbstractCairoTest)

Example 32 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testThreeIntrinsics.

@Test
public void testThreeIntrinsics() throws Exception {
    IntrinsicModel m;
    m = modelOf("sym in ('a', 'b') and ex in ('c') 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 33 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testEqualsZeroOverlapWithIn.

@Test
public void testEqualsZeroOverlapWithIn() throws Exception {
    IntrinsicModel m = modelOf("sym in ('x','y') and sym = 'z'");
    Assert.assertEquals(IntrinsicValue.FALSE, m.intrinsicValue);
}
Also used : IntrinsicModel(com.questdb.griffin.lexer.model.IntrinsicModel) AbstractCairoTest(com.questdb.cairo.AbstractCairoTest)

Example 34 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testNotEqualsOverlapWithIn.

@Test
public void testNotEqualsOverlapWithIn() throws Exception {
    IntrinsicModel m = modelOf("sym in ('x','y') and sym != 'y' and ex != 'blah'");
    assertFilter(m, "'blah'ex!=");
    Assert.assertEquals("[x]", m.keyValues.toString());
    Assert.assertEquals("[8]", m.keyValuePositions.toString());
}
Also used : IntrinsicModel(com.questdb.griffin.lexer.model.IntrinsicModel) AbstractCairoTest(com.questdb.cairo.AbstractCairoTest)

Example 35 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testNestedFunctionTest.

@Test
public void testNestedFunctionTest() throws Exception {
    IntrinsicModel m = modelOf("substr(parse(x, 1, 3), 2, 4)");
    Assert.assertNull(m.intervals);
    assertFilter(m, "4231xparsesubstr");
}
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