@SuppressWarnings("unchecked") public static <R extends Tuple> TupleSummaryAggregator<R> create(TupleTypeInfoBase<?> inType) { Aggregator[] columnAggregators = new Aggregator[inType.getArity()]; for (int field = 0; field < inType.getArity(); field++) { Class clazz = inType.getTypeAt(field).getTypeClass(); columnAggregators[field] = SummaryAggregatorFactory.create(clazz); } return new TupleSummaryAggregator<>(columnAggregators); }
private void configure(String lineDelimiter, String fieldDelimiter, TupleTypeInfoBase<OUT> tupleTypeInfo, boolean[] includedFieldsMask) { if (tupleTypeInfo.getArity() == 0) { throw new IllegalArgumentException("Tuple size must be greater than 0."); } if (includedFieldsMask == null) { includedFieldsMask = createDefaultMask(tupleTypeInfo.getArity()); } tupleSerializer = (TupleSerializerBase<OUT>) tupleTypeInfo.createSerializer(new ExecutionConfig()); setDelimiter(lineDelimiter); setFieldDelimiter(fieldDelimiter); Class<?>[] classes = new Class<?>[tupleTypeInfo.getArity()]; for (int i = 0; i < tupleTypeInfo.getArity(); i++) { classes[i] = tupleTypeInfo.getTypeAt(i).getTypeClass(); } setFieldsGeneric(includedFieldsMask, classes); }
@Override public boolean equals(Object obj) { if (obj instanceof TupleTypeInfo) { @SuppressWarnings("unchecked") TupleTypeInfo<T> other = (TupleTypeInfo<T>) obj; return other.canEqual(this) && super.equals(other) && Arrays.equals(fieldNames, other.fieldNames); } else { return false; } }
int fieldPos = Integer.valueOf(field); if(fieldPos >= this.getArity()) { throw new InvalidFieldReferenceException("Tuple field expression \""+fieldStr+"\" out of bounds of "+this.toString()+"."); TypeInformation<X> fieldType = this.getTypeAt(fieldPos); String tail = matcher.group(5); if(tail == null) {
final TupleTypeInfoBase<?> tupleTypeInfo = (TupleTypeInfoBase<?>) typeInfo; HashMap<String, TaggedValue> containerMapping = new HashMap<String, TaggedValue>(); for (int i = 0; i < tupleTypeInfo.getArity(); i++) { final String fieldName; tupleTypeInfo.getTypeAt(i), (flatFieldExpr.length() > 0 ? flatFieldExpr + "." : "") + fieldName, tupleTypeInfo.getFlatFields(fieldName), groupedKeys));
} else if (typeInfo.isTupleType() && ((TupleTypeInfoBase) typeInfo).isCaseClass()) { TupleTypeInfoBase tupleTypeInfo = (TupleTypeInfoBase) typeInfo; FieldExpression decomp = decomposeFieldExpression(field); int fieldPos = tupleTypeInfo.getFieldIndex(decomp.head); if (fieldPos < 0) { throw new CompositeType.InvalidFieldReferenceException("Invalid field selected: " + field); } else { @SuppressWarnings("unchecked") FieldAccessor<Object, F> innerAccessor = getAccessor(tupleTypeInfo.getTypeAt(fieldPos), decomp.tail, config); return new FieldAccessor.RecursiveProductFieldAccessor<>(fieldPos, typeInfo, innerAccessor, config);
@Override public void setInputType(TypeInformation<?> type, ExecutionConfig executionConfig) { if (!type.isTupleType()) { throw new IllegalArgumentException("Input TypeInformation is not a tuple type."); } TupleTypeInfoBase<?> tupleType = (TupleTypeInfoBase<?>) type; if (tupleType.getArity() != 2) { throw new IllegalArgumentException("Input TypeInformation must be a Tuple2 type."); } }
} else if (typeInfo.isTupleType() && ((TupleTypeInfoBase) typeInfo).isCaseClass()) { TupleTypeInfoBase tupleTypeInfo = (TupleTypeInfoBase) typeInfo; @SuppressWarnings("unchecked") TypeInformation<F> fieldTypeInfo = (TypeInformation<F>) tupleTypeInfo.getTypeAt(pos); return new FieldAccessor.RecursiveProductFieldAccessor<>( pos, typeInfo, new FieldAccessor.SimpleFieldAccessor<>(fieldTypeInfo), config);
stack.push(((TupleTypeInfoBase) typeInfo).getTypeAt(i));
@Override public int hashCode() { return 31 * super.hashCode(); }
public TupleParquetInputFormat(Path filePath, TupleTypeInfoBase<OUT> tupleTypeInfo, String[] fieldNames, ExecutionConfig config) { super(filePath, extractTypeInfo(tupleTypeInfo), fieldNames); this.tupleSerializer = (TupleSerializerBase<OUT>) tupleTypeInfo.createSerializer(config); }
int fieldPos = Integer.valueOf(field); if (fieldPos >= this.getArity()) { throw new InvalidFieldReferenceException("Tuple field expression \"" + fieldStr + "\" out of bounds of " + this.toString() + "."); TypeInformation<?> fieldType = this.getTypeAt(fieldPos); String tail = matcher.group(5); if (tail == null) { offset += this.getTypeAt(i).getTotalFields(); flatFieldPos += this.getTypeAt(i).getTotalFields(); offset += this.getTypeAt(i).getTotalFields();
final TupleTypeInfoBase<?> tupleTypeInfo = (TupleTypeInfoBase<?>) typeInfo; HashMap<String, TaggedValue> containerMapping = new HashMap<String, TaggedValue>(); for (int i = 0; i < tupleTypeInfo.getArity(); i++) { final String fieldName; tupleTypeInfo.getTypeAt(i), (flatFieldExpr.length() > 0 ? flatFieldExpr + "." : "") + fieldName, tupleTypeInfo.getFlatFields(fieldName), groupedKeys));
} else if (typeInfo.isTupleType() && ((TupleTypeInfoBase) typeInfo).isCaseClass()) { TupleTypeInfoBase tupleTypeInfo = (TupleTypeInfoBase) typeInfo; FieldExpression decomp = decomposeFieldExpression(field); int fieldPos = tupleTypeInfo.getFieldIndex(decomp.head); if (fieldPos < 0) { throw new CompositeType.InvalidFieldReferenceException("Invalid field selected: " + field); } else { @SuppressWarnings("unchecked") FieldAccessor<Object, F> innerAccessor = getAccessor(tupleTypeInfo.getTypeAt(fieldPos), decomp.tail, config); return new FieldAccessor.RecursiveProductFieldAccessor<>(fieldPos, typeInfo, innerAccessor, config);
public TupleCsvInputFormat(Path filePath, String lineDelimiter, String fieldDelimiter, TupleTypeInfoBase<OUT> tupleTypeInfo) { this(filePath, lineDelimiter, fieldDelimiter, tupleTypeInfo, createDefaultMask(tupleTypeInfo.getArity())); }
} else if (typeInfo.isTupleType() && ((TupleTypeInfoBase) typeInfo).isCaseClass()) { TupleTypeInfoBase tupleTypeInfo = (TupleTypeInfoBase) typeInfo; @SuppressWarnings("unchecked") TypeInformation<F> fieldTypeInfo = (TypeInformation<F>) tupleTypeInfo.getTypeAt(pos); return new FieldAccessor.RecursiveProductFieldAccessor<>( pos, typeInfo, new FieldAccessor.SimpleFieldAccessor<>(fieldTypeInfo), config);
stack.push(((TupleTypeInfoBase) typeInfo).getTypeAt(i));
@Override public int hashCode() { return 31 * super.hashCode() + Arrays.hashCode(fieldNames); }
@Override public void setInputType(TypeInformation<?> type, ExecutionConfig executionConfig) { if (!type.isTupleType()) { throw new IllegalArgumentException("Input TypeInformation is not a tuple type."); } TupleTypeInfoBase<?> tupleType = (TupleTypeInfoBase<?>) type; if (tupleType.getArity() != 2) { throw new IllegalArgumentException("Input TypeInformation must be a Tuple2 type."); } TypeInformation<K> keyType = tupleType.getTypeAt(0); TypeInformation<V> valueType = tupleType.getTypeAt(1); this.keyClass = keyType.getTypeClass(); this.valueClass = valueType.getTypeClass(); }
int fieldPos = Integer.valueOf(field); if(fieldPos >= this.getArity()) { throw new InvalidFieldReferenceException("Tuple field expression \""+fieldStr+"\" out of bounds of "+this.toString()+"."); TypeInformation<X> fieldType = this.getTypeAt(fieldPos); String tail = matcher.group(5); if(tail == null) {