public ColumnIO getChild(int fieldIndex) { try { return children.get(fieldIndex); } catch (IndexOutOfBoundsException e) { throw new InvalidRecordException("could not get child " + fieldIndex + " from " + children, e); } }
public ColumnIO getChild(int fieldIndex) { try { return children.get(fieldIndex); } catch (IndexOutOfBoundsException e) { throw new InvalidRecordException("could not get child " + fieldIndex + " from " + children, e); } }
@Override public Type getType(String[] path, int i) { if (path.length != i) { throw new InvalidRecordException("Arrived at primitive node at index " + i + " , path invalid: " + Arrays.toString(path)); } return this; }
@Override public Type getType(String[] path, int i) { if (path.length != i) { throw new InvalidRecordException("Arrived at primitive node at index " + i + " , path invalid: " + Arrays.toString(path)); } return this; }
void checkContains(Type subType) { if (!this.name.equals(subType.name) || this.repetition != subType.repetition) { throw new InvalidRecordException(subType + " found: expected " + this); } }
void checkContains(Type subType) { if (!this.name.equals(subType.name) || this.repetition != subType.repetition) { throw new InvalidRecordException(subType + " found: expected " + this); } }
/** * * @param name string name of a field * @return the index of the field with that name */ public int getFieldIndex(String name) { if (!indexByName.containsKey(name)) { throw new InvalidRecordException(name + " not found in " + this); } return indexByName.get(name); }
/** * * @param name string name of a field * @return the index of the field with that name */ public int getFieldIndex(String name) { if (!indexByName.containsKey(name)) { throw new InvalidRecordException(name + " not found in " + this); } return indexByName.get(name); }
@Override public void checkContains(Type subType) { if (!(subType instanceof MessageType)) { throw new InvalidRecordException(subType + " found: expected " + this); } checkGroupContains(subType); }
@Override public int getMaxRepetitionLevel(String[] path, int i) { if (path.length != i) { throw new InvalidRecordException("Arrived at primitive node, path invalid"); } return isRepetition(Repetition.REPEATED)? 1 : 0; }
@Override public int getMaxRepetitionLevel(String[] path, int i) { if (path.length != i) { throw new InvalidRecordException("Arrived at primitive node, path invalid"); } return isRepetition(Repetition.REPEATED)? 1 : 0; }
@Override public int getMaxDefinitionLevel(String[] path, int i) { if (path.length != i) { throw new InvalidRecordException("Arrived at primitive node, path invalid"); } return isRepetition(Repetition.REQUIRED) ? 0 : 1; }
private FieldWriter unknownType(Descriptors.FieldDescriptor fieldDescriptor) { String exceptionMsg = "Unknown type with descriptor \"" + fieldDescriptor + "\" and type \"" + fieldDescriptor.getJavaType() + "\"."; throw new InvalidRecordException(exceptionMsg); }
@Override public int getMaxDefinitionLevel(String[] path, int i) { if (path.length != i) { throw new InvalidRecordException("Arrived at primitive node, path invalid"); } return isRepetition(Repetition.REQUIRED) ? 0 : 1; }
@Override public void checkContains(Type subType) { if (!(subType instanceof MessageType)) { throw new InvalidRecordException(subType + " found: expected " + this); } checkGroupContains(subType); }
/** * Translates given parquet enum value to protocol buffer enum value. * @throws org.apache.parquet.io.InvalidRecordException is there is no corresponding value. * */ private Descriptors.EnumValueDescriptor translateEnumValue(Binary binaryValue) { Descriptors.EnumValueDescriptor protoValue = enumLookup.get(binaryValue); if (protoValue == null) { Set<Binary> knownValues = enumLookup.keySet(); String msg = "Illegal enum value \"" + binaryValue + "\"" + " in protocol buffer \"" + fieldType.getFullName() + "\"" + " legal values are: \"" + knownValues + "\""; throw new InvalidRecordException(msg); } return protoValue; }
/** * {@inheritDoc} */ public void startField(String field, int index) { if (index <= previousField.peek()) { throw new InvalidRecordException("fields must be added in order " + field + " index " + index + " is before previous field " + previousField.peek()); } validateMissingFields(index); fields.push(index); fieldValueCount.push(0); delegate.startField(field, index); }
@Override void checkContains(Type subType) { super.checkContains(subType); if (!subType.isPrimitive()) { throw new InvalidRecordException(subType + " found: expected " + this); } PrimitiveType primitiveType = subType.asPrimitiveType(); if (this.primitive != primitiveType.primitive) { throw new InvalidRecordException(subType + " found: expected " + this); } }
/** * {@inheritDoc} */ public void startField(String field, int index) { if (index <= previousField.peek()) { throw new InvalidRecordException("fields must be added in order " + field + " index " + index + " is before previous field " + previousField.peek()); } validateMissingFields(index); fields.push(index); fieldValueCount.push(0); delegate.startField(field, index); }
@Override void checkContains(Type subType) { super.checkContains(subType); if (!subType.isPrimitive()) { throw new InvalidRecordException(subType + " found: expected " + this); } PrimitiveType primitiveType = subType.asPrimitiveType(); if (this.primitive != primitiveType.primitive) { throw new InvalidRecordException(subType + " found: expected " + this); } }