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 03:39:22 UTC

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

KurtYoung 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_r343464200
 
 

 ##########
 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:
   Just new a normal `Object[]` is enough?

----------------------------------------------------------------
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