@Test public void convertToRow() { String string = " ROW < id INT, name STRING > "; RowTypeInfo rowType = DataTypeUtils.convertToRow(string); String[] fieldNames = rowType.getFieldNames(); Assert.assertTrue("id".equals(fieldNames[0])); Assert.assertTrue("name".equals(fieldNames[1])); TypeInformation[] fieldTypes = rowType.getFieldTypes(); Assert.assertTrue(Types.INT() == fieldTypes[0]); Assert.assertTrue(Types.STRING() == fieldTypes[1]); }
public static RowTypeInfo convertToRow(String rowTypeString) { Matcher matcher = matchCompositeType(rowTypeString); final String errorMsg = rowTypeString + "convert to row type error!"; Preconditions.checkState(matcher.find(), errorMsg); String normalizedType = normalizeType(matcher.group(1)); Preconditions.checkState(ROW.equals(normalizedType), errorMsg); String elementTypeStr = matcher.group(2); Iterable<String> fieldInfoStrs = splitCompositeTypeField(elementTypeStr); Tuple2<TypeInformation[], String[]> info = genFieldInfo(fieldInfoStrs); return new RowTypeInfo(info.f0, info.f1); }
DataTypeUtils { public static RowTypeInfo convertToRow(String rowTypeString) { Matcher matcher = matchCompositeType(rowTypeString); final String errorMsg = rowTypeString + "convert to row type error!"; Preconditions.checkState(matcher.find(), errorMsg); String normalizedType = normalizeType(matcher.group(1)); Preconditions.checkState(ROW.equals(normalizedType), errorMsg); String elementTypeStr = matcher.group(2); Iterable<String> fieldInfoStrs = splitCompositeTypeField(elementTypeStr); Tuple2<TypeInformation[], String[]> info = genFieldInfo(fieldInfoStrs); return new RowTypeInfo(info.f0, info.f1); } }
DataTypeUtils { public static RowTypeInfo convertToRow(String rowTypeString) { Matcher matcher = matchCompositeType(rowTypeString); final String errorMsg = rowTypeString + "convert to row type error!"; Preconditions.checkState(matcher.find(), errorMsg); String normalizedType = normalizeType(matcher.group(1)); Preconditions.checkState(ROW.equals(normalizedType), errorMsg); String elementTypeStr = matcher.group(2); Iterable<String> fieldInfoStrs = splitCompositeTypeField(elementTypeStr); Tuple2<TypeInformation[], String[]> info = genFieldInfo(fieldInfoStrs); return new RowTypeInfo(info.f0, info.f1); } private  DataTypeUtils(); }
DataTypeUtils { public static RowTypeInfo convertToRow(String rowTypeString) { Matcher matcher = matchCompositeType(rowTypeString); final String errorMsg = rowTypeString + "convert to row type error!"; Preconditions.checkState(matcher.find(), errorMsg); String normalizedType = normalizeType(matcher.group(1)); Preconditions.checkState(ROW.equals(normalizedType), errorMsg); String elementTypeStr = matcher.group(2); Iterable<String> fieldInfoStrs = splitCompositeTypeField(elementTypeStr); Tuple2<TypeInformation[], String[]> info = genFieldInfo(fieldInfoStrs); return new RowTypeInfo(info.f0, info.f1); } private  DataTypeUtils(); static TypeInformation convertToCompositeType(String compositeTypeString); static TypeInformation convertToArray(String arrayTypeString); static RowTypeInfo convertToRow(String rowTypeString); static TypeInformation convertToAtomicType(String string); }
DataTypeUtils { public static RowTypeInfo convertToRow(String rowTypeString) { Matcher matcher = matchCompositeType(rowTypeString); final String errorMsg = rowTypeString + "convert to row type error!"; Preconditions.checkState(matcher.find(), errorMsg); String normalizedType = normalizeType(matcher.group(1)); Preconditions.checkState(ROW.equals(normalizedType), errorMsg); String elementTypeStr = matcher.group(2); Iterable<String> fieldInfoStrs = splitCompositeTypeField(elementTypeStr); Tuple2<TypeInformation[], String[]> info = genFieldInfo(fieldInfoStrs); return new RowTypeInfo(info.f0, info.f1); } private  DataTypeUtils(); static TypeInformation convertToCompositeType(String compositeTypeString); static TypeInformation convertToArray(String arrayTypeString); static RowTypeInfo convertToRow(String rowTypeString); static TypeInformation convertToAtomicType(String string);  }