Search in sources :

Example 6 with Expression

use of org.apache.iceberg.expressions.Expression in project drill by apache.

the class TestFilterTransformer method testToFilterMetadataTypesSeveral.

@Test
public void testToFilterMetadataTypesSeveral() {
    Expression expected = Expressions.in(MetastoreColumn.METADATA_TYPE.columnName(), MetadataType.PARTITION.name(), MetadataType.FILE.name());
    Expression actual = transformer.transform(Sets.newHashSet(MetadataType.PARTITION, MetadataType.FILE));
    assertEquals(expected.toString(), actual.toString());
}
Also used : FilterExpression(org.apache.drill.metastore.expressions.FilterExpression) Expression(org.apache.iceberg.expressions.Expression) Test(org.junit.Test) IcebergBaseTest(org.apache.drill.metastore.iceberg.IcebergBaseTest)

Example 7 with Expression

use of org.apache.iceberg.expressions.Expression in project drill by apache.

the class TestFilterTransformer method testToFilterAnd.

@Test
public void testToFilterAnd() {
    Expression expected = Expressions.and(Expressions.equal(MetastoreColumn.STORAGE_PLUGIN.columnName(), "dfs"), Expressions.equal(MetastoreColumn.WORKSPACE.columnName(), "tmp"), Expressions.equal(MetastoreColumn.TABLE_NAME.columnName(), "nation"), Expressions.equal(MetastoreColumn.ROW_GROUP_INDEX.columnName(), 4));
    Expression actual = transformer.transform(FilterExpression.and(FilterExpression.equal(MetastoreColumn.STORAGE_PLUGIN, "dfs"), FilterExpression.equal(MetastoreColumn.WORKSPACE, "tmp"), FilterExpression.equal(MetastoreColumn.TABLE_NAME, "nation"), FilterExpression.equal(MetastoreColumn.ROW_GROUP_INDEX, 4)));
    assertEquals(expected.toString(), actual.toString());
}
Also used : FilterExpression(org.apache.drill.metastore.expressions.FilterExpression) Expression(org.apache.iceberg.expressions.Expression) Test(org.junit.Test) IcebergBaseTest(org.apache.drill.metastore.iceberg.IcebergBaseTest)

Example 8 with Expression

use of org.apache.iceberg.expressions.Expression in project drill by apache.

the class TestFilterTransformer method testToFilterNotEqual.

@Test
public void testToFilterNotEqual() {
    Expression expected = Expressions.notEqual(MetastoreColumn.ROW_GROUP_INDEX.columnName(), 1);
    Expression actual = transformer.transform(FilterExpression.notEqual(MetastoreColumn.ROW_GROUP_INDEX, 1));
    assertEquals(expected.toString(), actual.toString());
}
Also used : FilterExpression(org.apache.drill.metastore.expressions.FilterExpression) Expression(org.apache.iceberg.expressions.Expression) Test(org.junit.Test) IcebergBaseTest(org.apache.drill.metastore.iceberg.IcebergBaseTest)

Example 9 with Expression

use of org.apache.iceberg.expressions.Expression in project drill by apache.

the class TestFilterTransformer method testToFilterIn.

@Test
public void testToFilterIn() {
    Expression expected = Expressions.in(MetastoreColumn.ROW_GROUP_INDEX.columnName(), 1, 2);
    Expression actual = transformer.transform(FilterExpression.in(MetastoreColumn.ROW_GROUP_INDEX, 1, 2));
    assertEquals(expected.toString(), actual.toString());
}
Also used : FilterExpression(org.apache.drill.metastore.expressions.FilterExpression) Expression(org.apache.iceberg.expressions.Expression) Test(org.junit.Test) IcebergBaseTest(org.apache.drill.metastore.iceberg.IcebergBaseTest)

Example 10 with Expression

use of org.apache.iceberg.expressions.Expression in project drill by apache.

the class TestFilterTransformer method testToFilterConditionsTwo.

@Test
public void testToFilterConditionsTwo() {
    Map<MetastoreColumn, Object> conditions = new LinkedHashMap<>();
    conditions.put(MetastoreColumn.STORAGE_PLUGIN, "dfs");
    conditions.put(MetastoreColumn.WORKSPACE, "tmp");
    Expression expected = Expressions.and(Expressions.equal(MetastoreColumn.STORAGE_PLUGIN.columnName(), "dfs"), Expressions.equal(MetastoreColumn.WORKSPACE.columnName(), "tmp"));
    assertEquals(expected.toString(), transformer.transform(conditions).toString());
}
Also used : FilterExpression(org.apache.drill.metastore.expressions.FilterExpression) Expression(org.apache.iceberg.expressions.Expression) MetastoreColumn(org.apache.drill.metastore.MetastoreColumn) LinkedHashMap(java.util.LinkedHashMap) Test(org.junit.Test) IcebergBaseTest(org.apache.drill.metastore.iceberg.IcebergBaseTest)

Aggregations

Expression (org.apache.iceberg.expressions.Expression)40 FilterExpression (org.apache.drill.metastore.expressions.FilterExpression)28 IcebergBaseTest (org.apache.drill.metastore.iceberg.IcebergBaseTest)26 Test (org.junit.Test)26 MetastoreColumn (org.apache.drill.metastore.MetastoreColumn)5 Map (java.util.Map)4 Path (org.apache.hadoop.fs.Path)3 TupleDomain (com.facebook.presto.common.predicate.TupleDomain)2 HashMap (java.util.HashMap)2 LogicalExpression (org.apache.drill.common.expression.LogicalExpression)2 TableMetadataUnit (org.apache.drill.metastore.components.tables.TableMetadataUnit)2 Delete (org.apache.drill.metastore.iceberg.operate.Delete)2 MapWork (org.apache.hadoop.hive.ql.plan.MapWork)2 TableScan (org.apache.iceberg.TableScan)2 Domain (com.facebook.presto.common.predicate.Domain)1 Marker (com.facebook.presto.common.predicate.Marker)1 Range (com.facebook.presto.common.predicate.Range)1 SortedRangeSet (com.facebook.presto.common.predicate.SortedRangeSet)1 ValueSet (com.facebook.presto.common.predicate.ValueSet)1 ArrayType (com.facebook.presto.common.type.ArrayType)1