You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2019/11/07 04:58:54 UTC

[GitHub] [flink] buptljy commented on a change in pull request #10107: [FLINK-14608] [flink-json] Avoid using Java Streams in JsonRowDeserializationSchema

buptljy commented on a change in pull request #10107: [FLINK-14608] [flink-json] Avoid using Java Streams in JsonRowDeserializationSchema
URL: https://github.com/apache/flink/pull/10107#discussion_r343476683
 
 

 ##########
 File path: flink-formats/flink-json/src/main/java/org/apache/flink/formats/json/JsonRowDeserializationSchema.java
 ##########
 @@ -429,13 +428,21 @@ private Object convertField(
 		}
 	}
 
-	private DeserializationRuntimeConverter assembleArrayConverter(DeserializationRuntimeConverter elementConverter) {
+	private DeserializationRuntimeConverter assembleArrayConverter(
+		TypeInformation<?> elementType,
+		DeserializationRuntimeConverter elementConverter) {
+
+		final Class<?> elementClass = elementType.getTypeClass();
+
 		return (mapper, jsonNode) -> {
-			ArrayNode node = (ArrayNode) jsonNode;
+			final ArrayNode node = (ArrayNode) jsonNode;
+			final Object[] array = (Object[]) Array.newInstance(elementClass, node.size());
 
 Review comment:
   `new Object[node.size()]` and `(Object[]) Array.newInstance(elementClass, node.size())` are a bit different though it may not affect the result here because we have `elementConverter` to care about the element type. I'm just trying to make the expression's semantics more precise here :).

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services