use of com.questdb.griffin.lexer.model.IntrinsicModel in project questdb by bluestreak01.
the class QueryFilterAnalyserTest method testPreferredColumn.
@Test
public void testPreferredColumn() 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", "ex");
assertFilter(m, "110ask<100bid>'b''a'syminandand");
TestUtils.assertEquals("ex", m.keyColumn);
Assert.assertEquals("[c]", m.keyValues.toString());
TestUtils.assertEquals("[{lo=2014-01-01T12:30:00.000000Z, hi=2014-01-02T12:30:00.000000Z}]", intervalToString(m.intervals));
}
use of com.questdb.griffin.lexer.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`)");
TestUtils.assertEquals("sym", m.keyColumn);
Assert.assertEquals(1, m.keyValues.size());
TestUtils.assertEquals("xyz", m.keyValues.get(0));
Assert.assertTrue(m.keyValuesIsLambda);
Assert.assertNotNull(m.filter);
Assert.assertEquals("sym12in", GriffinParserTestUtils.toRpn(m.filter));
}
use of com.questdb.griffin.lexer.model.IntrinsicModel in project questdb by bluestreak01.
the class QueryFilterAnalyserTest method testFilterOrInterval.
@Test
public void testFilterOrInterval() throws Exception {
IntrinsicModel m = modelOf("bid > 100 or timestamp in (\"2014-01-01T12:30:00.000Z\", \"2014-01-02T12:30:00.000Z\")");
Assert.assertNull(m.intervals);
assertFilter(m, "\"2014-01-02T12:30:00.000Z\"\"2014-01-01T12:30:00.000Z\"timestampin100bid>or");
}
use of com.questdb.griffin.lexer.model.IntrinsicModel in project questdb by bluestreak01.
the class QueryFilterAnalyserTest method testListOfValuesOverlapWithNotClause.
@Test
public void testListOfValuesOverlapWithNotClause() 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 ('c', 'd', 'e'))");
Assert.assertEquals("[a,z]", m.keyValues.toString());
Assert.assertNull(m.filter);
Assert.assertEquals(IntrinsicValue.UNDEFINED, m.intrinsicValue);
}
use of com.questdb.griffin.lexer.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\")");
TestUtils.assertEquals("[{lo=2014-01-01T12:30:00.000000Z, hi=2014-01-02T12:30:00.000000Z}]", intervalToString(m.intervals));
TestUtils.assertEquals("sym", m.keyColumn);
Assert.assertEquals("[a,b,c]", m.keyValues.toString());
Assert.assertEquals("[8,13,18]", m.keyValuePositions.toString());
Assert.assertNull(m.filter);
}
Aggregations