use of io.crate.analyze.WhereClause in project crate by crate.
the class WhereClauseAnalyzerTest method testOptimizationNonRoundingFunctionGreater.
@Test
public void testOptimizationNonRoundingFunctionGreater() throws Exception {
WhereClause whereClause = analyzeSelectWhere("select * from double_gen_parted where x > 3");
assertThat(whereClause.query(), isSQL("(doc.double_gen_parted.x > 3)"));
assertThat(whereClause.partitions().size(), is(1));
assertThat(whereClause.partitions().get(0), is(".partitioned.double_gen_parted.0813a0hm"));
}
use of io.crate.analyze.WhereClause in project crate by crate.
the class WhereClauseAnalyzerTest method test4ColPrimaryKeySetLiteral.
@Test
public void test4ColPrimaryKeySetLiteral() throws Exception {
WhereClause whereClause = analyzeSelectWhere("select * from pk4 where i1=10 and i2=20 and" + " i3 in (30, 31) and i4=40");
assertThat(whereClause.docKeys().get(), containsInAnyOrder(isDocKey(10, 20, 30, 40), isDocKey(10, 20, 31, 40)));
}
use of io.crate.analyze.WhereClause in project crate by crate.
the class WhereClauseAnalyzerTest method test1ColPrimaryKeySetLiteral.
@Test
public void test1ColPrimaryKeySetLiteral() throws Exception {
WhereClause whereClause = analyzeSelectWhere("select name from users where id in ('1', '2')");
assertFalse(whereClause.noMatch());
assertThat(whereClause.docKeys().get(), containsInAnyOrder(isDocKey("1"), isDocKey("2")));
}
use of io.crate.analyze.WhereClause in project crate by crate.
the class WhereClauseAnalyzerTest method testGtGenColOptimization.
@Test
public void testGtGenColOptimization() throws Exception {
WhereClause whereClause = analyzeSelectWhere("select * from generated_col where ts > '2015-01-02T12:00:00'");
assertThat(whereClause.partitions().size(), is(1));
assertThat(whereClause.partitions().get(0), is(new PartitionName("generated_col", Arrays.asList(new BytesRef("1420156800000"), new BytesRef("-2"))).asIndexName()));
}
use of io.crate.analyze.WhereClause in project crate by crate.
the class WhereClauseAnalyzerTest method testClusteredByValueContainsComma.
@Test
public void testClusteredByValueContainsComma() throws Exception {
WhereClause whereClause = analyzeSelectWhere("select * from bystring where name = 'a,b,c'");
assertThat(whereClause.clusteredBy().get(), contains(isLiteral("a,b,c")));
assertThat(whereClause.docKeys().get().size(), is(1));
assertThat(whereClause.docKeys().get().getOnlyKey(), isDocKey("a,b,c"));
}
Aggregations