use of com.questdb.parser.sql.model.IntrinsicModel in project questdb by bluestreak01.
the class QueryFilterAnalyserTest method testThreeIntrinsics2.
@Test
public void testThreeIntrinsics2() 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");
assertFilter(m, "110ask<100bid>'c'exinandand");
Assert.assertEquals("sym", m.keyColumn);
Assert.assertEquals("[a,b]", m.keyValues.toString());
Assert.assertEquals("[Interval{lo=2014-01-01T12:30:00.000Z, hi=2014-01-02T12:30:00.000Z}]", IntervalCompiler.asIntervalStr(m.intervals));
}
use of com.questdb.parser.sql.model.IntrinsicModel in project questdb by bluestreak01.
the class QueryFilterAnalyserTest method testListOfValuesOverlapWithNotClause2.
@Test
public void testListOfValuesOverlapWithNotClause2() 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 ('a', 'd', 'e'))");
Assert.assertNull(m.filter);
Assert.assertEquals("[z]", m.keyValues.toString());
Assert.assertEquals(IntrinsicValue.UNDEFINED, m.intrinsicValue);
}
use of com.questdb.parser.sql.model.IntrinsicModel in project questdb by bluestreak01.
the class QueryFilterAnalyserTest method testIntervalSourceHour.
@Test
public void testIntervalSourceHour() throws Exception {
IntrinsicModel m = modelOf("timestamp = '2015-02-23T10:00:55.000Z;10m;3h;10'");
final String expected = "[Interval{lo=2015-02-23T10:00:55.000Z, hi=2015-02-23T10:10:55.000Z}," + "Interval{lo=2015-02-23T13:00:55.000Z, hi=2015-02-23T13:10:55.000Z}," + "Interval{lo=2015-02-23T16:00:55.000Z, hi=2015-02-23T16:10:55.000Z}," + "Interval{lo=2015-02-23T19:00:55.000Z, hi=2015-02-23T19:10:55.000Z}," + "Interval{lo=2015-02-23T22:00:55.000Z, hi=2015-02-23T22:10:55.000Z}," + "Interval{lo=2015-02-24T01:00:55.000Z, hi=2015-02-24T01:10:55.000Z}," + "Interval{lo=2015-02-24T04:00:55.000Z, hi=2015-02-24T04:10:55.000Z}," + "Interval{lo=2015-02-24T07:00:55.000Z, hi=2015-02-24T07:10:55.000Z}," + "Interval{lo=2015-02-24T10:00:55.000Z, hi=2015-02-24T10:10:55.000Z}," + "Interval{lo=2015-02-24T13:00:55.000Z, hi=2015-02-24T13:10:55.000Z}]";
Assert.assertEquals(expected, IntervalCompiler.asIntervalStr(m.intervals));
}
use of com.questdb.parser.sql.model.IntrinsicModel in project questdb by bluestreak01.
the class QueryFilterAnalyserTest method testTwoDiffColLambdas.
@Test
public void testTwoDiffColLambdas() throws Exception {
IntrinsicModel m = modelOf("sym in (`xyz`) and ex in (`kkk`)");
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(ExprNode.LAMBDA, m.filter.rhs.type);
}
use of com.questdb.parser.sql.model.IntrinsicModel in project questdb by bluestreak01.
the class QueryFilterAnalyserTest method testNoIntrinsics.
@Test
public void testNoIntrinsics() throws Exception {
IntrinsicModel m = modelOf("a > 10 or b > 20");
Assert.assertNull(m.intervals);
Assert.assertNull(m.keyColumn);
assertFilter(m, "20b>10a>or");
}
Aggregations