Search in sources :

Example 26 with IntrinsicModel

use of com.questdb.parser.sql.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.parser.sql.model.IntrinsicModel) AbstractTest(com.questdb.test.tools.AbstractTest) Test(org.junit.Test)

Example 27 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testComplexInterval2.

@Test
public void testComplexInterval2() throws Exception {
    IntrinsicModel m = modelOf("timestamp = '2015-02-23T10:00:55.000Z;7d'");
    Assert.assertEquals("[Interval{lo=2015-02-23T10:00:55.000Z, hi=2015-03-02T10:00:55.000Z}]", IntervalCompiler.asIntervalStr(m.intervals));
    Assert.assertEquals("IntrinsicModel{keyValues=[], keyColumn='null', filter=null}", m.toString());
}
Also used : IntrinsicModel(com.questdb.parser.sql.model.IntrinsicModel) AbstractTest(com.questdb.test.tools.AbstractTest) Test(org.junit.Test)

Example 28 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testEqualsChoiceOfColumns.

@Test
public void testEqualsChoiceOfColumns() throws Exception {
    IntrinsicModel m = modelOf("sym = 'X' and ex = 'Y'");
    assertFilter(m, "'Y'ex=");
    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)

Example 29 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testOr.

@Test
public void testOr() throws Exception {
    IntrinsicModel m = modelOf("(sym = 'X' or sym = 'Y') and bid > 10");
    Assert.assertEquals(IntrinsicValue.UNDEFINED, m.intrinsicValue);
    assertFilter(m, "10bid>'Y'sym='X'sym=orand");
}
Also used : IntrinsicModel(com.questdb.parser.sql.model.IntrinsicModel) AbstractTest(com.questdb.test.tools.AbstractTest) Test(org.junit.Test)

Example 30 with IntrinsicModel

use of com.questdb.parser.sql.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'");
    Assert.assertEquals("[Interval{lo=2015-02-23T10:00:55.000Z, hi=2015-02-23T10:30:55.000Z},Interval{lo=2015-02-25T10:00:55.000Z, hi=2015-02-25T10:30:55.000Z},Interval{lo=2015-02-27T10:00:55.000Z, hi=2015-02-27T10:30:55.000Z},Interval{lo=2015-03-01T10:00:55.000Z, hi=2015-03-01T10:30:55.000Z},Interval{lo=2015-03-03T10:00:55.000Z, hi=2015-03-03T10:30:55.000Z}]", IntervalCompiler.asIntervalStr(m.intervals));
}
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