Search in sources :

Example 1 with UpdateAnalyzedStatement

use of io.crate.analyze.UpdateAnalyzedStatement in project crate by crate.

the class WhereClauseAnalyzerTest method testUpdateWherePartitionedByColumn.

@Test
public void testUpdateWherePartitionedByColumn() throws Exception {
    UpdateAnalyzedStatement updateAnalyzedStatement = analyzeUpdate("update parted set id = 2 where date = 1395874800000");
    UpdateAnalyzedStatement.NestedAnalyzedStatement nestedAnalyzedStatement = updateAnalyzedStatement.nestedStatements().get(0);
    assertThat(nestedAnalyzedStatement.whereClause().hasQuery(), is(false));
    assertThat(nestedAnalyzedStatement.whereClause().noMatch(), is(false));
    assertEquals(ImmutableList.of(new PartitionName("parted", Arrays.asList(new BytesRef("1395874800000"))).asIndexName()), nestedAnalyzedStatement.whereClause().partitions());
}
Also used : PartitionName(io.crate.metadata.PartitionName) UpdateAnalyzedStatement(io.crate.analyze.UpdateAnalyzedStatement) BytesRef(org.apache.lucene.util.BytesRef) Test(org.junit.Test) CrateUnitTest(io.crate.test.integration.CrateUnitTest)

Aggregations

UpdateAnalyzedStatement (io.crate.analyze.UpdateAnalyzedStatement)1 PartitionName (io.crate.metadata.PartitionName)1 CrateUnitTest (io.crate.test.integration.CrateUnitTest)1 BytesRef (org.apache.lucene.util.BytesRef)1 Test (org.junit.Test)1