case LIST: final Types.ListType listType = type.asListType(); return String.format("array<%s>", fromIcebergToHiveType(listType.elementType())); case MAP: final Types.MapType mapType = type.asMapType();
return Types.ListType.ofOptional(columnIds.get(child), convertOrcToType(child, columnIds));
@Override public Type list(Types.ListType list, Supplier<Type> elementResult) { Preconditions.checkArgument(current instanceof ArrayType, "Not an array: %s", current); ArrayType array = (ArrayType) current; Preconditions.checkArgument(array.containsNull() || !list.isElementOptional(), "Cannot project an array of optional elements as required elements: %s", array); this.current = array.elementType(); try { Type elementType = elementResult.get(); if (list.elementType() == elementType) { return list; } // must be a projected element type, create a new list if (list.isElementOptional()) { return Types.ListType.ofOptional(list.elementId(), elementType); } else { return Types.ListType.ofRequired(list.elementId(), elementType); } } finally { this.current = array; } }
Types.NestedField.required(0, "id", Types.LongType.get()), Types.NestedField.optional(22, "points", Types.ListType.ofOptional(21, Types.StructType.of( Types.NestedField.required(19, "x", Types.IntegerType.get()), Types.NestedField.optional(18, "y", Types.IntegerType.get()) Types.ListType.ofOptional(21, Types.StructType.of( Types.NestedField.optional(18, "z", Types.IntegerType.get()) )) Types.ListType.ofOptional(21, Types.StructType.of( Types.NestedField.required(19, "x", Types.IntegerType.get()), Types.NestedField.optional(18, "y", Types.IntegerType.get()),
if (iType != null) { list = iType.asListType(); element = list.fields().get(0);
Types.NestedField.required(0, "id", Types.LongType.get()), Types.NestedField.optional(22, "points", Types.ListType.ofOptional(21, Types.StructType.of( Types.NestedField.required(19, "x", Types.IntegerType.get()), Types.NestedField.optional(18, "y", Types.IntegerType.get()) Types.ListType.ofOptional(21, Types.StructType.of( Types.NestedField.optional(18, "z", Types.IntegerType.get()) ))
result = TypeDescription.createList(toOrc(list.elementId(), list.elementType(), columnIds)); break;
Types.NestedField.required(0, "id", Types.LongType.get()), Types.NestedField.optional(22, "points", Types.ListType.ofOptional(21, Types.StructType.of( Types.NestedField.required(19, "x", Types.IntegerType.get()), Types.NestedField.optional(18, "y", Types.IntegerType.get()) Types.ListType.ofOptional(21, Types.StructType.of( Types.NestedField.optional(18, "z", Types.IntegerType.get()) ))
Types.NestedField.required(0, "id", Types.LongType.get()), Types.NestedField.optional(22, "points", Types.ListType.ofOptional(21, Types.StructType.of( Types.NestedField.required(19, "x", Types.IntegerType.get()), Types.NestedField.optional(18, "y", Types.IntegerType.get()) Record p1 = GenericRecord.create(writeSchema.findType("points").asListType().elementType().asStructType()); p1.setField("x", 1); p1.setField("y", 2); Record p2 = GenericRecord.create(writeSchema.findType("points").asListType().elementType().asStructType()); p2.setField("x", 3); p2.setField("y", null); Types.ListType.ofOptional(21, Types.StructType.of( Types.NestedField.optional(18, "z", Types.IntegerType.get()) ))
} else { Assert.assertEquals(prefix + " length", expected.numElements(), actual.size()); Type childType = type.elementType(); for (int e = 0; e < expected.numElements(); ++e) { switch (childType.typeId()) {
optional(25, "alt", Types.FloatType.get()) ))), optional(5, "points", Types.ListType.ofOptional(14, Types.StructType.of( required(15, "X", Types.LongType.get()), optional(27, "t.t", Types.LongType.get()) ))), required(6, "doubles", Types.ListType.ofRequired(17, Types.DoubleType.get() )),
case LIST: final Types.ListType listType = type.asListType(); return format("array<%s>", convert(listType.elementType())); case MAP: final Types.MapType mapType = type.asMapType();
optional(25, "alt", Types.FloatType.get()) ))), optional(5, "points", Types.ListType.ofOptional(14, Types.StructType.of( required(15, "x", Types.LongType.get()), optional(27, "t.t", Types.LongType.get()) ))), required(6, "doubles", Types.ListType.ofRequired(17, Types.DoubleType.get() )),
Schema listSchema = new Schema(required(1, "list_field", Types.ListType.ofRequired(2, from)));
required(13, "long", Types.FloatType.get()) ))), optional(5, "points", Types.ListType.ofOptional(14, Types.StructType.of( required(15, "X", Types.LongType.get()), required(16, "y.y", Types.LongType.get()) ))), required(6, "doubles", Types.ListType.ofRequired(17, Types.DoubleType.get() )),
T elementResult; visitor.fieldIds.push(list.elementId()); try { elementResult = visit(list.elementType(), visitor); } finally { visitor.fieldIds.pop();
case LIST: final Types.ListType listType = type.asListType(); return String.format("array<%s>", fromIcebergToHiveType(listType.elementType())); case MAP: final Types.MapType mapType = type.asMapType();
"Incompatible projected type: %s", current); Types.ListType list = current.asNestedType().asListType(); this.current = list.elementType(); try { Schema elementSchema = element.get();
required(13, "long", Types.DoubleType.get()) ))), optional(5, "points", Types.ListType.ofOptional(14, Types.StructType.of( required(15, "x", Types.LongType.get()), required(16, "y", Types.LongType.get()) ))), required(6, "doubles", Types.ListType.ofRequired(17, Types.DoubleType.get() )),
} else if (nested.isListType()) { parentField = nested.asListType().fields().get(0);