@Test public void testGetTypeAt() { RowTypeInfo typeInfo = new RowTypeInfo(typeList); assertArrayEquals(new String[]{"f0", "f1", "f2"}, typeInfo.getFieldNames()); assertEquals(BasicTypeInfo.STRING_TYPE_INFO, typeInfo.getTypeAt("f2")); assertEquals(BasicTypeInfo.SHORT_TYPE_INFO, typeInfo.getTypeAt("f1.f0")); assertEquals(BasicTypeInfo.BIG_DEC_TYPE_INFO, typeInfo.getTypeAt("f1.1")); }
@Override public <X> TypeInformation<X> getTypeAt(String fieldExpression) { Matcher matcher = PATTERN_NESTED_FIELDS.matcher(fieldExpression); if (!matcher.matches()) { if (fieldExpression.equals(ExpressionKeys.SELECT_ALL_CHAR) || fieldExpression.equals(ExpressionKeys.SELECT_ALL_CHAR_SCALA)) { throw new InvalidFieldReferenceException("Wildcard expressions are not allowed here."); } else { throw new InvalidFieldReferenceException("Invalid format of Row field expression \""+fieldExpression+"\"."); } } String field = matcher.group(1); Matcher intFieldMatcher = PATTERN_INT_FIELD.matcher(field); int fieldIndex; if (intFieldMatcher.matches()) { fieldIndex = Integer.valueOf(field); } else { fieldIndex = this.getFieldIndex(field); } TypeInformation<X> fieldType = this.getTypeAt(fieldIndex); String tail = matcher.group(3); if (tail == null) { return fieldType; } else { if (fieldType instanceof CompositeType) { return ((CompositeType<?>) fieldType).getTypeAt(tail); } else { throw new InvalidFieldReferenceException( "Nested field expression \""+ tail + "\" not possible on atomic type "+fieldType+"."); } } }
RowTypeInfo extends TupleTypeInfoBase<Row> { @Override public <X> TypeInformation<X> getTypeAt(String fieldExpression) { Matcher matcher = PATTERN_NESTED_FIELDS.matcher(fieldExpression); if (!matcher.matches()) { if (fieldExpression.equals(ExpressionKeys.SELECT_ALL_CHAR) || fieldExpression.equals(ExpressionKeys.SELECT_ALL_CHAR_SCALA)) { throw new InvalidFieldReferenceException("Wildcard expressions are not allowed here."); } else { throw new InvalidFieldReferenceException("Invalid format of Row field expression \""+fieldExpression+"\"."); } } String field = matcher.group(1); Matcher intFieldMatcher = PATTERN_INT_FIELD.matcher(field); int fieldIndex; if (intFieldMatcher.matches()) { fieldIndex = Integer.valueOf(field); } else { fieldIndex = this.getFieldIndex(field); } TypeInformation<X> fieldType = this.getTypeAt(fieldIndex); String tail = matcher.group(3); if (tail == null) { return fieldType; } else { if (fieldType instanceof CompositeType) { return ((CompositeType<?>) fieldType).getTypeAt(tail); } else { throw new InvalidFieldReferenceException( "Nested field expression \""+ tail + "\" not possible on atomic type "+fieldType+"."); } } } }
RowTypeInfo extends TupleTypeInfoBase<Row> { @Override public <X> TypeInformation<X> getTypeAt(String fieldExpression) { Matcher matcher = PATTERN_NESTED_FIELDS.matcher(fieldExpression); if (!matcher.matches()) { if (fieldExpression.equals(ExpressionKeys.SELECT_ALL_CHAR) || fieldExpression.equals(ExpressionKeys.SELECT_ALL_CHAR_SCALA)) { throw new InvalidFieldReferenceException("Wildcard expressions are not allowed here."); } else { throw new InvalidFieldReferenceException("Invalid format of Row field expression \""+fieldExpression+"\"."); } } String field = matcher.group(1); Matcher intFieldMatcher = PATTERN_INT_FIELD.matcher(field); int fieldIndex; if (intFieldMatcher.matches()) { fieldIndex = Integer.valueOf(field); } else { fieldIndex = this.getFieldIndex(field); } TypeInformation<X> fieldType = this.getTypeAt(fieldIndex); String tail = matcher.group(3); if (tail == null) { return fieldType; } else { if (fieldType instanceof CompositeType) { return ((CompositeType<?>) fieldType).getTypeAt(tail); } else { throw new InvalidFieldReferenceException( "Nested field expression \""+ tail + "\" not possible on atomic type "+fieldType+"."); } } } RowTypeInfo(TypeInformation<?>... types);  RowTypeInfo(TypeInformation<?>[] types, String[] fieldNames); }
RowTypeInfo extends TupleTypeInfoBase<Row> { @Override public <X> TypeInformation<X> getTypeAt(String fieldExpression) { Matcher matcher = PATTERN_NESTED_FIELDS.matcher(fieldExpression); if (!matcher.matches()) { if (fieldExpression.equals(ExpressionKeys.SELECT_ALL_CHAR) || fieldExpression.equals(ExpressionKeys.SELECT_ALL_CHAR_SCALA)) { throw new InvalidFieldReferenceException("Wildcard expressions are not allowed here."); } else { throw new InvalidFieldReferenceException("Invalid format of Row field expression \""+fieldExpression+"\"."); } } String field = matcher.group(1); Matcher intFieldMatcher = PATTERN_INT_FIELD.matcher(field); int fieldIndex; if (intFieldMatcher.matches()) { fieldIndex = Integer.valueOf(field); } else { fieldIndex = this.getFieldIndex(field); } TypeInformation<X> fieldType = this.getTypeAt(fieldIndex); String tail = matcher.group(3); if (tail == null) { return fieldType; } else { if (fieldType instanceof CompositeType) { return ((CompositeType<?>) fieldType).getTypeAt(tail); } else { throw new InvalidFieldReferenceException( "Nested field expression \""+ tail + "\" not possible on atomic type "+fieldType+"."); } } } RowTypeInfo(TypeInformation<?>... types);  RowTypeInfo(TypeInformation<?>[] types, String[] fieldNames); @Override void getFlatFields(String fieldExpression, int offset, List<FlatFieldDescriptor> result); @Override TypeInformation<X> getTypeAt(String fieldExpression); @Override TypeComparator<Row> createComparator(
		int[] logicalKeyFields,
		boolean[] orders,
		int logicalFieldOffset,
		ExecutionConfig config); @Override String[] getFieldNames(); @Override int getFieldIndex(String fieldName); @Override TypeSerializer<Row> createSerializer(ExecutionConfig config); @Override boolean canEqual(Object obj); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); TypeInformation<?>[] getFieldTypes(); boolean schemaEquals(Object obj); static RowTypeInfo projectFields(RowTypeInfo rowType, int[] fieldMapping); }
RowTypeInfo extends TupleTypeInfoBase<Row> { @Override public <X> TypeInformation<X> getTypeAt(String fieldExpression) { Matcher matcher = PATTERN_NESTED_FIELDS.matcher(fieldExpression); if (!matcher.matches()) { if (fieldExpression.equals(ExpressionKeys.SELECT_ALL_CHAR) || fieldExpression.equals(ExpressionKeys.SELECT_ALL_CHAR_SCALA)) { throw new InvalidFieldReferenceException("Wildcard expressions are not allowed here."); } else { throw new InvalidFieldReferenceException("Invalid format of Row field expression \""+fieldExpression+"\"."); } } String field = matcher.group(1); Matcher intFieldMatcher = PATTERN_INT_FIELD.matcher(field); int fieldIndex; if (intFieldMatcher.matches()) { fieldIndex = Integer.valueOf(field); } else { fieldIndex = this.getFieldIndex(field); } TypeInformation<X> fieldType = this.getTypeAt(fieldIndex); String tail = matcher.group(3); if (tail == null) { return fieldType; } else { if (fieldType instanceof CompositeType) { return ((CompositeType<?>) fieldType).getTypeAt(tail); } else { throw new InvalidFieldReferenceException( "Nested field expression \""+ tail + "\" not possible on atomic type "+fieldType+"."); } } } RowTypeInfo(TypeInformation<?>... types);  RowTypeInfo(TypeInformation<?>[] types, String[] fieldNames); @Override void getFlatFields(String fieldExpression, int offset, List<FlatFieldDescriptor> result); @Override TypeInformation<X> getTypeAt(String fieldExpression); @Override TypeComparator<Row> createComparator(
		int[] logicalKeyFields,
		boolean[] orders,
		int logicalFieldOffset,
		ExecutionConfig config); @Override String[] getFieldNames(); @Override int getFieldIndex(String fieldName); @Override TypeSerializer<Row> createSerializer(ExecutionConfig config); @Override boolean canEqual(Object obj); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); TypeInformation<?>[] getFieldTypes(); boolean schemaEquals(Object obj); static RowTypeInfo projectFields(RowTypeInfo rowType, int[] fieldMapping);  }