Search in sources :

Example 21 with Expression

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

the class TestFilterTransformer method testToFilterLessThan.

@Test
public void testToFilterLessThan() {
    Expression expected = Expressions.lessThan(MetastoreColumn.ROW_GROUP_INDEX.columnName(), 1);
    Expression actual = transformer.transform(FilterExpression.lessThan(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 22 with Expression

use of org.apache.iceberg.expressions.Expression 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());
}
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 23 with Expression

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

the class TestFilterTransformer method testCombineNone.

@Test
public void testCombineNone() {
    Expression expected = Expressions.alwaysTrue();
    Expression actual = transformer.combine();
    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 24 with Expression

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

the class TestFilterTransformer method testToFilterConditionsFour.

@Test
public void testToFilterConditionsFour() {
    Map<MetastoreColumn, Object> conditions = new LinkedHashMap<>();
    conditions.put(MetastoreColumn.STORAGE_PLUGIN, "dfs");
    conditions.put(MetastoreColumn.WORKSPACE, "tmp");
    conditions.put(MetastoreColumn.TABLE_NAME, "nation");
    conditions.put(MetastoreColumn.ROW_GROUP_INDEX, 4);
    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));
    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)

Example 25 with Expression

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

the class TestFilterTransformer method testToFilterNotIn.

@Test
public void testToFilterNotIn() {
    Expression expected = Expressions.notIn(MetastoreColumn.ROW_GROUP_INDEX.columnName(), 1, 2);
    Expression actual = transformer.transform(FilterExpression.notIn(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)

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