use of io.crate.analyze.DeleteAnalyzedStatement in project crate by crate.
the class WhereClauseAnalyzerTest method testWhereSinglePKColumnEq.
@Test
public void testWhereSinglePKColumnEq() throws Exception {
DeleteAnalyzedStatement statement = e.analyze("delete from users where id = ?", new Object[][] { new Object[] { 1 }, new Object[] { 2 }, new Object[] { 3 } });
DocTableRelation tableRelation = statement.analyzedRelation();
WhereClauseAnalyzer whereClauseAnalyzer = new WhereClauseAnalyzer(e.functions(), tableRelation);
assertThat(whereClauseAnalyzer.analyze(statement.whereClauses().get(0), transactionContext).docKeys().get(), contains(isDocKey("1")));
assertThat(whereClauseAnalyzer.analyze(statement.whereClauses().get(1), transactionContext).docKeys().get(), contains(isDocKey("2")));
assertThat(whereClauseAnalyzer.analyze(statement.whereClauses().get(2), transactionContext).docKeys().get(), contains(isDocKey("3")));
}
use of io.crate.analyze.DeleteAnalyzedStatement in project crate by crate.
the class WhereClauseAnalyzerTest method testWherePartitionedByColumn.
@Test
public void testWherePartitionedByColumn() throws Exception {
DeleteAnalyzedStatement statement = e.analyze("delete from parted where date = 1395874800000");
WhereClause whereClause = statement.whereClauses().get(0);
assertThat(whereClause.hasQuery(), is(false));
assertThat(whereClause.noMatch(), is(false));
assertThat(whereClause.partitions(), Matchers.contains(new PartitionName("parted", Arrays.asList(new BytesRef("1395874800000"))).asIndexName()));
}
Aggregations