Search in sources :

Example 51 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testLiteralInListOfValues.

@Test
public void testLiteralInListOfValues() throws Exception {
    IntrinsicModel m = modelOf("sym in (\"a\", z) and timestamp in (\"2014-01-01T12:30:00.000Z\", \"2014-01-02T12:30:00.000Z\")");
    Assert.assertEquals("[Interval{lo=2014-01-01T12:30:00.000Z, hi=2014-01-02T12:30:00.000Z}]", IntervalCompiler.asIntervalStr(m.intervals));
    Assert.assertNull(m.keyColumn);
    assertFilter(m, "z\"a\"symin");
}
Also used : IntrinsicModel(com.questdb.parser.sql.model.IntrinsicModel) AbstractTest(com.questdb.test.tools.AbstractTest) Test(org.junit.Test)

Example 52 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testPreferredColumn2.

@Test
public void testPreferredColumn2() throws Exception {
    IntrinsicModel m;
    m = modelOf("ex in ('c') and sym in ('a', 'b') and timestamp in ('2014-01-01T12:30:00.000Z', '2014-01-02T12:30:00.000Z') and bid > 100 and ask < 110", "ex");
    assertFilter(m, "110ask<100bid>'b''a'syminandand");
    Assert.assertEquals("ex", m.keyColumn);
    Assert.assertEquals("[c]", m.keyValues.toString());
    Assert.assertEquals("[Interval{lo=2014-01-01T12:30:00.000Z, hi=2014-01-02T12:30:00.000Z}]", IntervalCompiler.asIntervalStr(m.intervals));
}
Also used : IntrinsicModel(com.questdb.parser.sql.model.IntrinsicModel) AbstractTest(com.questdb.test.tools.AbstractTest) Test(org.junit.Test)

Example 53 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testManualIntervalInverted.

@Test
public void testManualIntervalInverted() throws Exception {
    IntrinsicModel m = modelOf("'2014-01-02T12:30:00.000Z' > timestamp and '2014-01-01T15:30:00.000Z' <= timestamp ");
    Assert.assertEquals("[Interval{lo=2014-01-01T15:30:00.000Z, hi=2014-01-02T12:29:59.999Z}]", IntervalCompiler.asIntervalStr(m.intervals));
}
Also used : IntrinsicModel(com.questdb.parser.sql.model.IntrinsicModel) AbstractTest(com.questdb.test.tools.AbstractTest) Test(org.junit.Test)

Example 54 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testLiteralInInterval.

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

Example 55 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testSimpleInterval.

@Test
public void testSimpleInterval() throws Exception {
    IntrinsicModel m = modelOf("timestamp in (\"2014-01-01T12:30:00.000Z\", \"2014-01-02T12:30:00.000Z\")");
    Assert.assertEquals("[Interval{lo=2014-01-01T12:30:00.000Z, hi=2014-01-02T12:30:00.000Z}]", IntervalCompiler.asIntervalStr(m.intervals));
    Assert.assertNull(m.filter);
}
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