use of org.apache.iceberg.Schema in project hive by apache.
the class TestHiveIcebergComplexTypeWrites method testWriteArrayOfMapsInTable.
@Test
public void testWriteArrayOfMapsInTable() throws IOException {
Schema schema = new Schema(required(1, "id", Types.LongType.get()), required(2, "arrayofmaps", Types.ListType.ofRequired(3, Types.MapType.ofRequired(4, 5, Types.StringType.get(), Types.StringType.get()))));
List<Record> records = TestHelper.generateRandomRecords(schema, 5, 1L);
testComplexTypeWrite(schema, records);
}
use of org.apache.iceberg.Schema in project hive by apache.
the class TestHiveIcebergComplexTypeWrites method testWriteStructOfArraysInTable.
@Test
public void testWriteStructOfArraysInTable() throws IOException {
Schema schema = new Schema(required(1, "id", Types.LongType.get()), required(2, "structofarrays", Types.StructType.of(required(3, "names", Types.ListType.ofRequired(4, Types.StringType.get())), required(5, "birthdays", Types.ListType.ofRequired(6, Types.StringType.get())))));
List<Record> records = TestHelper.generateRandomRecords(schema, 5, 1L);
testComplexTypeWrite(schema, records);
}
use of org.apache.iceberg.Schema in project hive by apache.
the class TestHiveIcebergComplexTypeWrites method testWriteArrayOfPrimitivesInTable.
@Test
public void testWriteArrayOfPrimitivesInTable() throws IOException {
Schema schema = new Schema(required(1, "id", Types.LongType.get()), required(2, "arrayofprimitives", Types.ListType.ofRequired(3, Types.StringType.get())));
List<Record> records = TestHelper.generateRandomRecords(schema, 5, 0L);
testComplexTypeWrite(schema, records);
}
use of org.apache.iceberg.Schema in project hive by apache.
the class TestHiveIcebergComplexTypeWrites method testWriteStructOfPrimitivesInTable.
@Test
public void testWriteStructOfPrimitivesInTable() throws IOException {
Schema schema = new Schema(required(1, "id", Types.LongType.get()), required(2, "structofprimitives", Types.StructType.of(required(3, "key", Types.StringType.get()), required(4, "value", Types.StringType.get()))));
List<Record> records = TestHelper.generateRandomRecords(schema, 5, 0L);
testComplexTypeWrite(schema, records);
}
use of org.apache.iceberg.Schema in project hive by apache.
the class TestHiveIcebergInserts method testInsertSupportedTypes.
@Test
public void testInsertSupportedTypes() throws IOException {
for (int i = 0; i < SUPPORTED_TYPES.size(); i++) {
Type type = SUPPORTED_TYPES.get(i);
// TODO: remove this filter when issue #1881 is resolved
if (type == Types.UUIDType.get() && fileFormat == FileFormat.PARQUET) {
continue;
}
// TODO: remove this filter when we figure out how we could test binary types
if (type.equals(Types.BinaryType.get()) || type.equals(Types.FixedType.ofLength(5))) {
continue;
}
String columnName = type.typeId().toString().toLowerCase() + "_column";
Schema schema = new Schema(required(1, "id", Types.LongType.get()), required(2, columnName, type));
List<Record> expected = TestHelper.generateRandomRecords(schema, 5, 0L);
Table table = testTables.createTable(shell, type.typeId().toString().toLowerCase() + "_table_" + i, schema, PartitionSpec.unpartitioned(), fileFormat, expected);
HiveIcebergTestUtils.validateData(table, expected, 0);
}
}
Aggregations