Source:
<code>public InputFormat<RowData, ?> createReader(ReaderContext context) { DescriptorProperties properties = getValidatedProperties(context.getFormatProperties()); boolean failOnMissingField = properties.getOptionalBoolean(FORMAT_FAIL_ON_MISSING_FIELD).orElse(false); boolean ignoreParseErrors = properties.getOptionalBoolean(FORMAT_IGNORE_PARSE_ERRORS).orElse(false); TableSchema tableSchema = context.getSchema(); List<DataType> fieldTypes = Arrays.asList(tableSchema.getFieldDataTypes()); List<String> fieldNames = Arrays.asList(tableSchema.getFieldNames()); String[] nonPartFieldNames = fieldNames.stream() .filter(name -> !context.getPartitionKeys().contains(name)).toArray(String[]::new); <START> DataType[] nonPartFieldTypes = Arrays.asList(nonPartFieldNames).stream() <END> .map(name -> fieldTypes.get(fieldNames.indexOf(name))).toArray(DataType[]::new); RowType nonPartRowType = RowType.of( Arrays.asList(nonPartFieldTypes).stream() .map(DataType::getLogicalType) .toArray(LogicalType[]::new), nonPartFieldNames); int[] selectFields = context.getProjectFields(); List<String> partitionKeys = context.getPartitionKeys(); List<String> selectFieldNames = Arrays.stream(selectFields) .mapToObj(fieldNames::get) .collect(Collectors.toList()); List<String> jsonSelectFieldNames = selectFieldNames.stream() .filter(name -> !partitionKeys.contains(name)).collect(Collectors.toList()); int[] jsonFieldMapping = jsonSelectFieldNames.stream().mapToInt(selectFieldNames::indexOf).toArray(); JsonRowDataDeserializationSchema deserializationSchema = new JsonRowDataDeserializationSchema( nonPartRowType, new GenericTypeInfo(GenericRowData.class), failOnMissingField, ignoreParseErrors); return new JsonInputFormat( context.getPaths(), fieldTypes, fieldNames, selectFields, partitionKeys, context.getDefaultPartName(), context.getPushedDownLimit(), jsonSelectFieldNames, jsonFieldMapping, deserializationSchema); }</code><technical_language>Notice Arrays.stream</technical_language>

Target:
public InputFormat<RowData, ?> createReader(ReaderContext context) { DescriptorProperties properties = getValidatedProperties(context.getFormatProperties()); boolean failOnMissingField = properties.getOptionalBoolean(FORMAT_FAIL_ON_MISSING_FIELD).orElse(false); boolean ignoreParseErrors = properties.getOptionalBoolean(FORMAT_IGNORE_PARSE_ERRORS).orElse(false); RowType formatRowType = context.getFormatRowType(); JsonRowDataDeserializationSchema deserializationSchema = new JsonRowDataDeserializationSchema( formatRowType, new GenericTypeInfo(GenericRowData.class), failOnMissingField, ignoreParseErrors); String[] fieldNames = context.getSchema().getFieldNames(); List<String> projectFields = Arrays.stream(context.getProjectFields()) .mapToObj(idx -> fieldNames[idx]) .collect(Collectors.toList()); List<String> jsonFields = Arrays.stream(fieldNames) .filter(field -> !context.getPartitionKeys().contains(field)) .collect(Collectors.toList()); int[] jsonSelectFieldToProjectFieldMapping = context.getFormatProjectFields().stream() .mapToInt(projectFields::indexOf) .toArray(); int[] jsonSelectFieldToJsonFieldMapping = context.getFormatProjectFields().stream() .mapToInt(jsonFields::indexOf) .toArray(); return new JsonInputFormat( context.getPaths(), context.getSchema().getFieldDataTypes(), context.getSchema().getFieldNames(), context.getProjectFields(), context.getPartitionKeys(), context.getDefaultPartName(), context.getPushedDownLimit(), jsonSelectFieldToProjectFieldMapping, jsonSelectFieldToJsonFieldMapping, deserializationSchema); }