use of org.apache.drill.metastore.expressions.FilterExpression in project drill by apache.
the class TestBasicTablesRequestsRequestMetadata method testRequestMetadataWithAndFilter.
@Test
public void testRequestMetadataWithAndFilter() {
BasicTablesRequests.RequestMetadata requestMetadata = BasicTablesRequests.RequestMetadata.builder().location("/tmp/dir").column("col").build();
FilterExpression expected = FilterExpression.and(FilterExpression.equal(MetastoreColumn.LOCATION, "/tmp/dir"), FilterExpression.equal(MetastoreColumn.COLUMN, "col"));
assertEquals(expected.toString(), requestMetadata.filter().toString());
}
use of org.apache.drill.metastore.expressions.FilterExpression in project drill by apache.
the class TestFilterTransformer method testToFilterNull.
@Test
public void testToFilterNull() {
Expression expected = Expressions.alwaysTrue();
Expression actual = transformer.transform((FilterExpression) null);
assertEquals(expected.toString(), actual.toString());
}
use of org.apache.drill.metastore.expressions.FilterExpression in project drill by apache.
the class TestFilterTransformer method testToFilterUnsupported.
@Test
public void testToFilterUnsupported() {
thrown.expect(UnsupportedOperationException.class);
transformer.transform(new FilterExpression() {
@Override
public Operator operator() {
return null;
}
@Override
public <T> T accept(Visitor<T> visitor) {
return visitor.visit(this);
}
});
}
use of org.apache.drill.metastore.expressions.FilterExpression in project drill by apache.
the class TestTablesOperationTransformer method testToDeleteOperationByFilter.
@Test
public void testToDeleteOperationByFilter() {
FilterExpression filter = FilterExpression.and(FilterExpression.equal(MetastoreColumn.STORAGE_PLUGIN, "dfs"), FilterExpression.equal(MetastoreColumn.WORKSPACE, "tmp"));
Expression expected = Expressions.and(Expressions.equal(MetastoreColumn.STORAGE_PLUGIN.columnName(), "dfs"), Expressions.equal(MetastoreColumn.WORKSPACE.columnName(), "tmp"));
Delete operation = transformer.toDelete(filter);
assertEquals(expected.toString(), operation.filter().toString());
}
use of org.apache.drill.metastore.expressions.FilterExpression in project drill by apache.
the class TestBasicTablesRequestsRequestMetadata method testRequestMetadataOneFilter.
@Test
public void testRequestMetadataOneFilter() {
BasicTablesRequests.RequestMetadata requestMetadata = BasicTablesRequests.RequestMetadata.builder().column("col").build();
FilterExpression expected = FilterExpression.equal(MetastoreColumn.COLUMN, "col");
assertEquals(expected.toString(), requestMetadata.filter().toString());
}
Aggregations