Search in sources :

Example 46 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testContradictingNullSearch.

@Test
public void testContradictingNullSearch() throws Exception {
    IntrinsicModel m = modelOf("sym = null and sym != null and ex != 'blah'");
    Assert.assertEquals(IntrinsicValue.FALSE, m.intrinsicValue);
    assertFilter(m, "'blah'ex!=");
    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 47 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testDubiousEquals.

@Test
public void testDubiousEquals() throws Exception {
    IntrinsicModel m = modelOf("sum(ts) = sum(ts)");
    Assert.assertNull(m.filter);
}
Also used : IntrinsicModel(com.questdb.parser.sql.model.IntrinsicModel) AbstractTest(com.questdb.test.tools.AbstractTest) Test(org.junit.Test)

Example 48 with IntrinsicModel

use of com.questdb.parser.sql.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`)");
    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("ex12in", TestUtils.toRpn(m.filter));
}
Also used : IntrinsicModel(com.questdb.parser.sql.model.IntrinsicModel) AbstractTest(com.questdb.test.tools.AbstractTest) Test(org.junit.Test)

Example 49 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testFilterMultipleKeysAndInterval.

@Test
public void testFilterMultipleKeysAndInterval() throws Exception {
    IntrinsicModel m = modelOf("sym in (\"a\", \"b\", \"c\") 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,b,c]", m.keyValues.toString());
    Assert.assertEquals("[8,13,18]", m.keyValuePositions.toString());
    Assert.assertNull(m.filter);
}
Also used : IntrinsicModel(com.questdb.parser.sql.model.IntrinsicModel) AbstractTest(com.questdb.test.tools.AbstractTest) Test(org.junit.Test)

Example 50 with IntrinsicModel

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

the class QueryFilterAnalyserTest method testEqualsChoiceOfColumns2.

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

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