use of org.apache.iceberg.expressions.Expression in project drill by apache.
the class TestFilterTransformer method testToFilterLessThanOrEqual.
@Test
public void testToFilterLessThanOrEqual() {
Expression expected = Expressions.lessThanOrEqual(MetastoreColumn.ROW_GROUP_INDEX.columnName(), 1);
Expression actual = transformer.transform(FilterExpression.lessThanOrEqual(MetastoreColumn.ROW_GROUP_INDEX, 1));
assertEquals(expected.toString(), actual.toString());
}
use of org.apache.iceberg.expressions.Expression in project drill by apache.
the class IcebergRead method internalExecute.
@Override
protected List<T> internalExecute() {
String[] selectedColumns = columns.isEmpty() ? defaultColumns : columns.stream().map(MetastoreColumn::columnName).toArray(String[]::new);
FilterTransformer filterTransformer = context.transformer().filter();
Expression rowFilter = filterTransformer.combine(filterTransformer.transform(metadataTypes), filterTransformer.transform(filter));
Iterable<Record> records = IcebergGenerics.read(context.table()).select(selectedColumns).where(rowFilter).build();
return context.transformer().outputData().columns(selectedColumns).records(Lists.newArrayList(records)).execute();
}
use of org.apache.iceberg.expressions.Expression in project drill by apache.
the class TestTablesOperationTransformer method testToDeleteOperation.
@Test
public void testToDeleteOperation() {
Expression expected = Expressions.equal(MetastoreColumn.STORAGE_PLUGIN.columnName(), "dfs");
org.apache.drill.metastore.operate.Delete delete = org.apache.drill.metastore.operate.Delete.builder().metadataType(MetadataType.ALL).filter(FilterExpression.equal(MetastoreColumn.STORAGE_PLUGIN, "dfs")).build();
Delete operation = transformer.toDelete(delete);
assertEquals(expected.toString(), operation.filter().toString());
}
use of org.apache.iceberg.expressions.Expression 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.iceberg.expressions.Expression in project drill by apache.
the class FilterExpressionVisitor method visit.
@Override
public Expression visit(DoubleExpressionPredicate.Or expression) {
Expression right = expression.right().accept(this);
Expression left = expression.left().accept(this);
return Expressions.or(right, left);
}
Aggregations