/** * Returns all GenericTypeInfos contained in a composite type. * * @param typeInfo {@link CompositeType} */ private static void getContainedGenericTypes(CompositeType<?> typeInfo, List<GenericTypeInfo<?>> target) { for (int i = 0; i < typeInfo.getArity(); i++) { TypeInformation<?> type = typeInfo.getTypeAt(i); if (type instanceof CompositeType) { getContainedGenericTypes((CompositeType<?>) type, target); } else if (type instanceof GenericTypeInfo) { if (!target.contains(type)) { target.add((GenericTypeInfo<?>) type); } } } }
@Override @PublicEvolving public boolean isKeyType() { for(int i=0;i<this.getArity();i++) { if (!this.getTypeAt(i).isKeyType()) { return false; } } return true; }
@Override @PublicEvolving public boolean isSortKeyType() { for(int i=0;i<this.getArity();i++) { if (!this.getTypeAt(i).isSortKeyType()) { return false; } } return true; }
private static <T> String getSerializerTree(TypeInformation<T> ti, int indent) { String ret = ""; if (ti instanceof CompositeType) { ret += StringUtils.repeat(' ', indent) + ti.getClass().getSimpleName() + "\n"; CompositeType<T> cti = (CompositeType<T>) ti; String[] fieldNames = cti.getFieldNames(); for (int i = 0; i < cti.getArity(); i++) { TypeInformation<?> fieldType = cti.getTypeAt(i); ret += StringUtils.repeat(' ', indent + 2) + fieldNames[i] + ":" + getSerializerTree(fieldType, indent); } } else { if (ti instanceof GenericTypeInfo) { ret += StringUtils.repeat(' ', indent) + "GenericTypeInfo (" + ti.getTypeClass().getSimpleName() + ")\n"; ret += getGenericTypeTree(ti.getTypeClass(), indent + 4); } else { ret += StringUtils.repeat(' ', indent) + ti.toString() + "\n"; } } return ret; }
public static SingleInputSemanticProperties createProjectionPropertiesSingle(int[] fields, CompositeType<?> inType) { Character.isJavaIdentifierStart(1); SingleInputSemanticProperties ssp = new SingleInputSemanticProperties(); int[] sourceOffsets = new int[inType.getArity()]; sourceOffsets[0] = 0; for (int i = 1; i < inType.getArity(); i++) { sourceOffsets[i] = inType.getTypeAt(i - 1).getTotalFields() + sourceOffsets[i - 1]; } int targetOffset = 0; for (int i = 0; i < fields.length; i++) { int sourceOffset = sourceOffsets[fields[i]]; int numFieldsToCopy = inType.getTypeAt(fields[i]).getTotalFields(); for (int j = 0; j < numFieldsToCopy; j++) { ssp.addForwardedField(sourceOffset + j, targetOffset + j); } targetOffset += numFieldsToCopy; } return ssp; }
boolean comparatorAdded = false; for (int localFieldId = 0; localFieldId < this.getArity() && logicalField <= logicalKeyField && !comparatorAdded; localFieldId++) { TypeInformation<?> localFieldType = this.getTypeAt(localFieldId);
/** * Returns all GenericTypeInfos contained in a composite type. * * @param typeInfo {@link CompositeType} */ private static void getContainedGenericTypes(CompositeType<?> typeInfo, List<GenericTypeInfo<?>> target) { for (int i = 0; i < typeInfo.getArity(); i++) { TypeInformation<?> type = typeInfo.getTypeAt(i); if (type instanceof CompositeType) { getContainedGenericTypes((CompositeType<?>) type, target); } else if (type instanceof GenericTypeInfo) { if (!target.contains(type)) { target.add((GenericTypeInfo<?>) type); } } } }
/** * Returns all GenericTypeInfos contained in a composite type. * * @param typeInfo {@link CompositeType} */ private static void getContainedGenericTypes(CompositeType<?> typeInfo, List<GenericTypeInfo<?>> target) { for (int i = 0; i < typeInfo.getArity(); i++) { TypeInformation<?> type = typeInfo.getTypeAt(i); if (type instanceof CompositeType) { getContainedGenericTypes((CompositeType<?>) type, target); } else if (type instanceof GenericTypeInfo) { if (!target.contains(type)) { target.add((GenericTypeInfo<?>) type); } } } }
@Override @PublicEvolving public boolean isSortKeyType() { for(int i=0;i<this.getArity();i++) { if (!this.getTypeAt(i).isSortKeyType()) { return false; } } return true; }
@Override @PublicEvolving public boolean isKeyType() { for(int i=0;i<this.getArity();i++) { if (!this.getTypeAt(i).isKeyType()) { return false; } } return true; }
@Override @PublicEvolving public boolean isKeyType() { for(int i=0;i<this.getArity();i++) { if (!this.getTypeAt(i).isKeyType()) { return false; } } return true; }
@Override @PublicEvolving public boolean isSortKeyType() { for(int i=0;i<this.getArity();i++) { if (!this.getTypeAt(i).isSortKeyType()) { return false; } } return true; }
private static <T> String getSerializerTree(TypeInformation<T> ti, int indent) { String ret = ""; if (ti instanceof CompositeType) { ret += StringUtils.repeat(' ', indent) + ti.getClass().getSimpleName() + "\n"; CompositeType<T> cti = (CompositeType<T>) ti; String[] fieldNames = cti.getFieldNames(); for (int i = 0; i < cti.getArity(); i++) { TypeInformation<?> fieldType = cti.getTypeAt(i); ret += StringUtils.repeat(' ', indent + 2) + fieldNames[i] + ":" + getSerializerTree(fieldType, indent); } } else { if (ti instanceof GenericTypeInfo) { ret += StringUtils.repeat(' ', indent) + "GenericTypeInfo (" + ti.getTypeClass().getSimpleName() + ")\n"; ret += getGenericTypeTree(ti.getTypeClass(), indent + 4); } else { ret += StringUtils.repeat(' ', indent) + ti.toString() + "\n"; } } return ret; }
private static <T> String getSerializerTree(TypeInformation<T> ti, int indent) { String ret = ""; if (ti instanceof CompositeType) { ret += StringUtils.repeat(' ', indent) + ti.getClass().getSimpleName() + "\n"; CompositeType<T> cti = (CompositeType<T>) ti; String[] fieldNames = cti.getFieldNames(); for (int i = 0; i < cti.getArity(); i++) { TypeInformation<?> fieldType = cti.getTypeAt(i); ret += StringUtils.repeat(' ', indent + 2) + fieldNames[i] + ":" + getSerializerTree(fieldType, indent); } } else { if (ti instanceof GenericTypeInfo) { ret += StringUtils.repeat(' ', indent) + "GenericTypeInfo (" + ti.getTypeClass().getSimpleName() + ")\n"; ret += getGenericTypeTree(ti.getTypeClass(), indent + 4); } else { ret += StringUtils.repeat(' ', indent) + ti.toString() + "\n"; } } return ret; }
private <E> TypeInformation[] getFieldTypes(TypeInformation<E> typeInfo, int[] fieldIndexes, String[] fieldNames) { TypeInformation[] fieldTypes; if (isCompositeType()) { CompositeType cType = (CompositeType) typeInfo; if (fieldNames.length != cType.getArity()) { // throw new IllegalArgumentException("Arity of type (" + cType.getFieldNames().length+ ") " + // "not equal to number of field names " + fieldNames.length + "."); LOGGER.warn("Arity of type (" + cType.getFieldNames().length + ") " + "not equal to number of field names " + fieldNames.length + "."); } fieldTypes = new TypeInformation[fieldIndexes.length]; for (int i = 0; i < fieldIndexes.length; i++) { fieldTypes[i] = cType.getTypeAt(fieldIndexes[i]); } } else if (isAtomicType()) { if (fieldIndexes.length != 1 || fieldIndexes[0] != 0) { throw new IllegalArgumentException( "Non-composite input type may have only a single field and its index must be 0."); } fieldTypes = new TypeInformation[]{typeInfo}; } else { throw new IllegalArgumentException( "Illegal input type info" ); } return fieldTypes; }
public static SingleInputSemanticProperties createProjectionPropertiesSingle(int[] fields, CompositeType<?> inType) { Character.isJavaIdentifierStart(1); SingleInputSemanticProperties ssp = new SingleInputSemanticProperties(); int[] sourceOffsets = new int[inType.getArity()]; sourceOffsets[0] = 0; for (int i = 1; i < inType.getArity(); i++) { sourceOffsets[i] = inType.getTypeAt(i - 1).getTotalFields() + sourceOffsets[i - 1]; } int targetOffset = 0; for (int i = 0; i < fields.length; i++) { int sourceOffset = sourceOffsets[fields[i]]; int numFieldsToCopy = inType.getTypeAt(fields[i]).getTotalFields(); for (int j = 0; j < numFieldsToCopy; j++) { ssp.addForwardedField(sourceOffset + j, targetOffset + j); } targetOffset += numFieldsToCopy; } return ssp; }
public static SingleInputSemanticProperties createProjectionPropertiesSingle(int[] fields, CompositeType<?> inType) { Character.isJavaIdentifierStart(1); SingleInputSemanticProperties ssp = new SingleInputSemanticProperties(); int[] sourceOffsets = new int[inType.getArity()]; sourceOffsets[0] = 0; for (int i = 1; i < inType.getArity(); i++) { sourceOffsets[i] = inType.getTypeAt(i - 1).getTotalFields() + sourceOffsets[i - 1]; } int targetOffset = 0; for (int i = 0; i < fields.length; i++) { int sourceOffset = sourceOffsets[fields[i]]; int numFieldsToCopy = inType.getTypeAt(fields[i]).getTotalFields(); for (int j = 0; j < numFieldsToCopy; j++) { ssp.addForwardedField(sourceOffset + j, targetOffset + j); } targetOffset += numFieldsToCopy; } return ssp; }
private <E> TypeInformation[] getFieldTypes(TypeInformation<E> typeInfo, int[] fieldIndexes, String[] fieldNames) { TypeInformation[] fieldTypes; if (isCompositeType()) { CompositeType cType = (CompositeType) typeInfo; if (fieldNames.length != cType.getArity()) { // throw new IllegalArgumentException("Arity of type (" + cType.getFieldNames().length+ ") " + // "not equal to number of field names " + fieldNames.length + "."); LOGGER.warn("Arity of type (" + cType.getFieldNames().length + ") " + "not equal to number of field names " + fieldNames.length + "."); } fieldTypes = new TypeInformation[fieldIndexes.length]; for (int i = 0; i < fieldIndexes.length; i++) { fieldTypes[i] = cType.getTypeAt(fieldIndexes[i]); } } else if (isAtomicType()) { if (fieldIndexes.length != 1 || fieldIndexes[0] != 0) { throw new IllegalArgumentException( "Non-composite input type may have only a single field and its index must be 0."); } fieldTypes = new TypeInformation[]{typeInfo}; } else { throw new IllegalArgumentException( "Illegal input type info" ); } return fieldTypes; }
boolean comparatorAdded = false; for (int localFieldId = 0; localFieldId < this.getArity() && logicalField <= logicalKeyField && !comparatorAdded; localFieldId++) { TypeInformation<?> localFieldType = this.getTypeAt(localFieldId);
boolean comparatorAdded = false; for (int localFieldId = 0; localFieldId < this.getArity() && logicalField <= logicalKeyField && !comparatorAdded; localFieldId++) { TypeInformation<?> localFieldType = this.getTypeAt(localFieldId);