/** * {@inheritDoc} */ @Override protected int typeHashCode() { int c = 17; c += 31 * getRepetition().hashCode(); c += 31 * getName().hashCode(); c += 31 * getFields().hashCode(); return c; }
@Override protected int getMaxRepetitionLevel(String[] path, int depth) { int myVal = getRepetition() == Repetition.REPEATED ? 1 : 0; if (depth == path.length) { return myVal; } return myVal + getType(path[depth]).getMaxRepetitionLevel(path, depth + 1); }
@Override protected int getMaxDefinitionLevel(String[] path, int depth) { int myVal = getRepetition() != Repetition.REQUIRED ? 1 : 0; if (depth == path.length) { return myVal; } return myVal + getType(path[depth]).getMaxDefinitionLevel(path, depth + 1); }
/** * {@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("}"); }
private static void showDetails(PrettyPrintWriter out, GroupType type, int depth, MessageType container, List<String> cpath) { String name = Strings.repeat(".", depth) + type.getName(); Repetition rep = type.getRepetition(); int fcount = type.getFieldCount(); out.format("%s: %s F:%d%n", name, rep, fcount); cpath.add(type.getName()); for (Type ftype : type.getFields()) { showDetails(out, ftype, depth + 1, container, cpath); } cpath.remove(cpath.size() - 1); }
/** * {@inheritDoc} */ @Override protected boolean typeEquals(Type other) { Type otherType = (Type) other; if (otherType.isPrimitive()) { return false; } else { GroupType groupType = otherType.asGroupType(); return getRepetition() == groupType.getRepetition() && getName().equals(groupType.getName()) && getFields().equals(groupType.getFields()); } }
/** * @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()); }
/** * @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)); }
schemaTypes.add(Types.buildGroup(groupFieldType.getRepetition()) .addFields(typesArray) .named(fieldType.getName())
@Override public void visit(GroupType groupType) { GroupColumnIO newIO; if (groupType.getRepetition() == Repetition.REPEATED) { newIO = new GroupColumnIO(groupType, current, current.getChildrenCount()); } else { newIO = new GroupColumnIO(groupType, current, current.getChildrenCount()); } current.add(newIO); visitChildren(newIO, groupType); }
@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); }