/** * {@inheritDoc} */ @Override public void writeToStringBuilder(StringBuilder sb, String indent) { sb.append(indent) .append(getRepetition().name().toLowerCase()) .append(" group ") .append(getName()) .append(getOriginalType() == null ? "" : " (" + getOriginalType() +")") .append(" {\n"); membersDisplayString(sb, indent + " "); sb.append(indent) .append("}"); }
/** * {@inheritDoc} */ @Override public void writeToStringBuilder(StringBuilder sb, String indent) { sb.append(indent) .append(getRepetition().name().toLowerCase()) .append(" group ") .append(getName()) .append(getOriginalType() == null ? "" : " (" + getOriginalType() +")") .append(getId() == null ? "" : " = " + getId()) .append(" {\n"); membersDisplayString(sb, indent + " "); sb.append(indent) .append("}"); }
public ParquetListEntryConverter(Type prestoType, String columnName, GroupType elementType) { checkArgument( elementType.getOriginalType() == null, "Expected LIST column '%s' field to be type STRUCT, but is %s", columnName, elementType); checkArgument( elementType.getFieldCount() == 1, "Expected LIST column '%s' element to have one field, but has %s fields", columnName, elementType.getFieldCount()); elementConverter = createConverter(prestoType, columnName + ".element", elementType.getType(0), 0); }
protected static HiveGroupConverter getConverterFromDescription(GroupType type, int index, ConverterParent parent) { if (type == null) { return null; } OriginalType annotation = type.getOriginalType(); if (annotation == OriginalType.LIST) { return HiveCollectionConverter.forList(type, parent, index); } else if (annotation == OriginalType.MAP || annotation == OriginalType.MAP_KEY_VALUE) { return HiveCollectionConverter.forMap(type, parent, index); } return new HiveStructConverter(type, parent, index); }
@Override public void visit(GroupType groupType) { SchemaElement element = new SchemaElement(groupType.getName()); element.setRepetition_type(toParquetRepetition(groupType.getRepetition())); if (groupType.getOriginalType() != null) { element.setConverted_type(getConvertedType(groupType.getOriginalType())); } visitChildren(result, groupType, element); }
/** * @param newFields * @return a group with the same attributes and new fields. */ public GroupType withNewFields(List<Type> newFields) { return new GroupType(getRepetition(), getName(), getOriginalType(), newFields, getId()); }
if (entryType.getOriginalType() != null) { checkArgument( entryType.getOriginalType() == MAP_KEY_VALUE, "Expected MAP column '%s' field to be type %s, but is %s", columnName,
/** * @param id the field id * @return a new GroupType with the same fields and a new id */ @Override public GroupType withId(int id) { return new GroupType(getRepetition(), getName(), getOriginalType(), fields, new ID(id)); }
} else { GroupType parquetGroupType = parquetType.asGroupType(); OriginalType originalType = parquetGroupType.getOriginalType(); if (originalType != null) { switch (originalType) { || !mapKeyValType.getOriginalType().equals(OriginalType.MAP_KEY_VALUE) || mapKeyValType.getFieldCount() != 2) { throw new UnsupportedOperationException("Invalid map type " + parquetGroupType);
private FieldSchema getComplexFieldSchema(String fieldName, Type parquetType) throws FrontendException { GroupType parquetGroupType = parquetType.asGroupType(); OriginalType originalType = parquetGroupType.getOriginalType(); if (originalType != null) { switch(originalType) { !mapKeyValType.getOriginalType().equals(OriginalType.MAP_KEY_VALUE) || mapKeyValType.getFieldCount()!=2) { throw new SchemaConversionException("Invalid map type " + parquetGroupType);