use of org.apache.drill.metastore.expressions.FilterExpression in project drill by apache.
the class TestBasicTablesRequestsRequestMetadata method testRequestMetadataWithInFilter.
@Test
public void testRequestMetadataWithInFilter() {
List<String> locations = Arrays.asList("/tmp/dir0", "/tmp/dir1");
List<String> metadataKeys = Arrays.asList("a", "b", "c");
BasicTablesRequests.RequestMetadata requestMetadata = BasicTablesRequests.RequestMetadata.builder().locations(locations).metadataKeys(metadataKeys).build();
FilterExpression expected = FilterExpression.and(FilterExpression.in(MetastoreColumn.LOCATION, locations), FilterExpression.in(MetastoreColumn.METADATA_KEY, metadataKeys));
assertEquals(expected.toString(), requestMetadata.filter().toString());
}
use of org.apache.drill.metastore.expressions.FilterExpression in project drill by apache.
the class TestTablesOperationTransformer method testToDeleteOperation.
@Test
public void testToDeleteOperation() {
Bson expected = Filters.and(Filters.eq(MetastoreColumn.STORAGE_PLUGIN.columnName(), "dfs"), Filters.eq(MetastoreColumn.WORKSPACE.columnName(), "tmp"));
FilterExpression filter = FilterExpression.and(FilterExpression.equal(MetastoreColumn.STORAGE_PLUGIN, "dfs"), FilterExpression.equal(MetastoreColumn.WORKSPACE, "tmp"));
Delete delete = Delete.builder().metadataType(MetadataType.ALL).filter(filter).build();
MongoDelete operation = transformer.toDelete(delete);
assertEquals(expected.toString(), operation.filter().toString());
}
use of org.apache.drill.metastore.expressions.FilterExpression in project drill by apache.
the class TestTablesMetadataMapper method testToCondition.
@Test
public void testToCondition() {
FilterExpression filterExpression = FilterExpression.equal(MetastoreColumn.STORAGE_PLUGIN, "dfs");
Condition tablesCondition = TablesMetadataMapper.TableMapper.get().toCondition(filterExpression);
assertEquals(Tables.TABLES.STORAGE_PLUGIN.eq("dfs"), tablesCondition);
Condition segmentsCondition = TablesMetadataMapper.SegmentMapper.get().toCondition(filterExpression);
assertEquals(Tables.SEGMENTS.STORAGE_PLUGIN.eq("dfs"), segmentsCondition);
Condition filesCondition = TablesMetadataMapper.FileMapper.get().toCondition(filterExpression);
assertEquals(Tables.FILES.STORAGE_PLUGIN.eq("dfs"), filesCondition);
Condition rowGroupsCondition = TablesMetadataMapper.RowGroupMapper.get().toCondition(filterExpression);
assertEquals(Tables.ROW_GROUPS.STORAGE_PLUGIN.eq("dfs"), rowGroupsCondition);
Condition partitionsCondition = TablesMetadataMapper.PartitionMapper.get().toCondition(filterExpression);
assertEquals(Tables.PARTITIONS.STORAGE_PLUGIN.eq("dfs"), partitionsCondition);
}
Aggregations