use of org.apache.iceberg.data.Record in project hive by apache.
the class TestIcebergInputFormats method testProjection.
@Test
public void testProjection() throws Exception {
helper.createTable();
List<Record> inputRecords = helper.generateRandomRecords(1, 0L);
helper.appendToTable(Row.of("2020-03-20", 0), inputRecords);
Schema projection = TypeUtil.select(SCHEMA, ImmutableSet.of(1));
builder.project(projection);
List<Record> outputRecords = testInputFormat.create(builder.conf()).getRecords();
Assert.assertEquals(inputRecords.size(), outputRecords.size());
Assert.assertEquals(projection.asStruct(), outputRecords.get(0).struct());
}
use of org.apache.iceberg.data.Record in project hive by apache.
the class TestHiveIcebergComplexTypeWrites method testWriteMapOfMapsInTable.
@Test
public void testWriteMapOfMapsInTable() throws IOException {
Schema schema = new Schema(required(1, "id", Types.LongType.get()), required(2, "mapofmaps", Types.MapType.ofRequired(3, 4, Types.StringType.get(), Types.MapType.ofRequired(5, 6, Types.StringType.get(), Types.StringType.get()))));
List<Record> records = TestHelper.generateRandomRecords(schema, 5, 0L);
testComplexTypeWrite(schema, records);
}
use of org.apache.iceberg.data.Record in project hive by apache.
the class TestHiveIcebergComplexTypeWrites method testWriteStructOfStructsInTable.
@Test
public void testWriteStructOfStructsInTable() throws IOException {
Schema schema = new Schema(required(1, "id", Types.LongType.get()), required(2, "structofstructs", Types.StructType.of(required(3, "struct1", Types.StructType.of(required(4, "key", Types.StringType.get()), required(5, "value", Types.StringType.get()))))));
List<Record> records = TestHelper.generateRandomRecords(schema, 5, 0L);
testComplexTypeWrite(schema, records);
}
use of org.apache.iceberg.data.Record in project hive by apache.
the class TestHiveIcebergComplexTypeWrites method testWriteStructOfMapsInTable.
@Test
public void testWriteStructOfMapsInTable() throws IOException {
Schema schema = new Schema(required(1, "id", Types.LongType.get()), required(2, "structofmaps", Types.StructType.of(required(3, "map1", Types.MapType.ofRequired(4, 5, Types.StringType.get(), Types.StringType.get())), required(6, "map2", Types.MapType.ofRequired(7, 8, Types.StringType.get(), Types.StringType.get())))));
List<Record> records = TestHelper.generateRandomRecords(schema, 5, 0L);
testComplexTypeWrite(schema, records);
}
use of org.apache.iceberg.data.Record in project hive by apache.
the class TestHiveIcebergComplexTypeWrites method testWriteArrayOfStructsInTable.
@Test
public void testWriteArrayOfStructsInTable() throws IOException {
Schema schema = new Schema(required(1, "id", Types.LongType.get()), required(2, "arrayofstructs", Types.ListType.ofRequired(3, Types.StructType.of(required(4, "something", Types.StringType.get()), required(5, "someone", Types.StringType.get()), required(6, "somewhere", Types.StringType.get())))));
List<Record> records = TestHelper.generateRandomRecords(schema, 5, 0L);
testComplexTypeWrite(schema, records);
}
Aggregations