Search in sources :

Example 31 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testAndBranchWithNonIndexedField.

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

Example 32 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testConstVsLambda2.

@Test
public void testConstVsLambda2() throws Exception {
    IntrinsicModel m = modelOf("sym in (1,2) and sym in (`xyz`)");
    Assert.assertEquals("sym", m.keyColumn);
    Assert.assertEquals(1, m.keyValues.size());
    Assert.assertEquals("xyz", m.keyValues.get(0));
    Assert.assertTrue(m.keyValuesIsLambda);
    Assert.assertNotNull(m.filter);
    Assert.assertEquals("sym12in", TestUtils.toRpn(m.filter));
}
Also used : IntrinsicModel(com.questdb.parser.sql.model.IntrinsicModel) AbstractTest(com.questdb.test.tools.AbstractTest) Test(org.junit.Test)

Example 33 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testOrNullSearch.

@Test
public void testOrNullSearch() throws Exception {
    IntrinsicModel m = modelOf("sym = null or sym != null and ex != 'blah'");
    Assert.assertEquals(IntrinsicValue.UNDEFINED, m.intrinsicValue);
    assertFilter(m, "'blah'ex!=nullsym!=nullsym=orand");
    Assert.assertEquals("[]", m.keyValues.toString());
    Assert.assertEquals("[]", m.keyValuePositions.toString());
}
Also used : IntrinsicModel(com.questdb.parser.sql.model.IntrinsicModel) AbstractTest(com.questdb.test.tools.AbstractTest) Test(org.junit.Test)

Example 34 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testTwoExactSameDates.

@Test
public void testTwoExactSameDates() throws Exception {
    IntrinsicModel m = modelOf("timestamp = '2015-05-10T15:03:10.000Z' and timestamp = '2015-05-10T15: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 35 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testFilterOnIndexedFieldAndInterval.

@Test
public void testFilterOnIndexedFieldAndInterval() throws Exception {
    IntrinsicModel m = modelOf("sym in ('a') 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.assertEquals("sym", m.keyColumn);
    Assert.assertEquals("[a]", m.keyValues.toString());
    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