Search in sources :

Example 1 with Row

use of org.apache.iceberg.TestHelpers.Row in project hive by apache.

the class DeleteReadTests method selectColumns.

private StructLikeSet selectColumns(StructLikeSet rows, String... columns) {
    Schema projection = table.schema().select(columns);
    StructLikeSet set = StructLikeSet.create(projection.asStruct());
    rows.stream().map(row -> StructProjection.create(table.schema(), projection).wrap(row)).forEach(set::add);
    return set;
}
Also used : Types(org.apache.iceberg.types.Types) Table(org.apache.iceberg.Table) StructLikeSet(org.apache.iceberg.util.StructLikeSet) Set(java.util.Set) Pair(org.apache.iceberg.util.Pair) IOException(java.io.IOException) Test(org.junit.Test) Schema(org.apache.iceberg.Schema) Row(org.apache.iceberg.TestHelpers.Row) Sets(org.apache.iceberg.relocated.com.google.common.collect.Sets) List(java.util.List) Lists(org.apache.iceberg.relocated.com.google.common.collect.Lists) Rule(org.junit.Rule) ArrayUtil(org.apache.iceberg.util.ArrayUtil) After(org.junit.After) PartitionSpec(org.apache.iceberg.PartitionSpec) DeleteFile(org.apache.iceberg.DeleteFile) DataFile(org.apache.iceberg.DataFile) Assert(org.junit.Assert) StructProjection(org.apache.iceberg.util.StructProjection) TemporaryFolder(org.junit.rules.TemporaryFolder) Files(org.apache.iceberg.Files) Before(org.junit.Before) Schema(org.apache.iceberg.Schema) StructLikeSet(org.apache.iceberg.util.StructLikeSet)

Example 2 with Row

use of org.apache.iceberg.TestHelpers.Row in project hive by apache.

the class DeleteReadTests method rowSetWithoutIds.

private StructLikeSet rowSetWithoutIds(int... idsToRemove) {
    Set<Integer> deletedIds = Sets.newHashSet(ArrayUtil.toIntList(idsToRemove));
    StructLikeSet set = StructLikeSet.create(table.schema().asStruct());
    records.stream().filter(row -> !deletedIds.contains(row.getField("id"))).forEach(set::add);
    return set;
}
Also used : Types(org.apache.iceberg.types.Types) Table(org.apache.iceberg.Table) StructLikeSet(org.apache.iceberg.util.StructLikeSet) Set(java.util.Set) Pair(org.apache.iceberg.util.Pair) IOException(java.io.IOException) Test(org.junit.Test) Schema(org.apache.iceberg.Schema) Row(org.apache.iceberg.TestHelpers.Row) Sets(org.apache.iceberg.relocated.com.google.common.collect.Sets) List(java.util.List) Lists(org.apache.iceberg.relocated.com.google.common.collect.Lists) Rule(org.junit.Rule) ArrayUtil(org.apache.iceberg.util.ArrayUtil) After(org.junit.After) PartitionSpec(org.apache.iceberg.PartitionSpec) DeleteFile(org.apache.iceberg.DeleteFile) DataFile(org.apache.iceberg.DataFile) Assert(org.junit.Assert) StructProjection(org.apache.iceberg.util.StructProjection) TemporaryFolder(org.junit.rules.TemporaryFolder) Files(org.apache.iceberg.Files) Before(org.junit.Before) StructLikeSet(org.apache.iceberg.util.StructLikeSet)

Aggregations

IOException (java.io.IOException)2 List (java.util.List)2 Set (java.util.Set)2 DataFile (org.apache.iceberg.DataFile)2 DeleteFile (org.apache.iceberg.DeleteFile)2 Files (org.apache.iceberg.Files)2 PartitionSpec (org.apache.iceberg.PartitionSpec)2 Schema (org.apache.iceberg.Schema)2 Table (org.apache.iceberg.Table)2 Row (org.apache.iceberg.TestHelpers.Row)2 Lists (org.apache.iceberg.relocated.com.google.common.collect.Lists)2 Sets (org.apache.iceberg.relocated.com.google.common.collect.Sets)2 Types (org.apache.iceberg.types.Types)2 ArrayUtil (org.apache.iceberg.util.ArrayUtil)2 Pair (org.apache.iceberg.util.Pair)2 StructLikeSet (org.apache.iceberg.util.StructLikeSet)2 StructProjection (org.apache.iceberg.util.StructProjection)2 After (org.junit.After)2 Assert (org.junit.Assert)2 Before (org.junit.Before)2