@Test public void testTypeInfoDeserialization() throws Exception { long id = 1238123899121L; String name = "asdlkjasjkdla998y1122"; byte[] bytes = new byte[1024]; ThreadLocalRandom.current().nextBytes(bytes); ObjectMapper objectMapper = new ObjectMapper(); ObjectNode root = objectMapper.createObjectNode(); root.put("id", id); root.put("name", name); root.put("bytes", bytes); byte[] serializedJson = objectMapper.writeValueAsBytes(root); JsonRowDeserializationSchema deserializationSchema = new JsonRowDeserializationSchema( Types.ROW_NAMED( new String[] { "id", "name", "bytes" }, Types.LONG, Types.STRING, Types.PRIMITIVE_ARRAY(Types.BYTE)) ); Row deserialized = deserializationSchema.deserialize(serializedJson); assertEquals(3, deserialized.getArity()); assertEquals(id, deserialized.getField(0)); assertEquals(name, deserialized.getField(1)); assertArrayEquals(bytes, (byte[]) deserialized.getField(2)); }
@Override public Row deserialize(byte[] message) throws IOException { try { final JsonNode root = objectMapper.readTree(message); return convertRow(root, (RowTypeInfo) typeInfo); } catch (Throwable t) { throw new IOException("Failed to deserialize JSON object.", t); } }
JsonRowDeserializationSchema implements DeserializationSchema<Row> { @Override public Row deserialize(byte[] message) throws IOException { try { final JsonNode root = objectMapper.readTree(message); return convertRow(root, (RowTypeInfo) typeInfo); } catch (Throwable t) { throw new IOException("Failed to deserialize JSON object.", t); } } }
JsonRowDeserializationSchema implements DeserializationSchema<Row> { @Override public Row deserialize(byte[] message) throws IOException { try { final JsonNode root = objectMapper.readTree(message); return convertRow(root, (RowTypeInfo) typeInfo); } catch (Throwable t) { throw new IOException("Failed to deserialize JSON object.", t); } } JsonRowDeserializationSchema(TypeInformation<Row> typeInfo);  JsonRowDeserializationSchema(String jsonSchema); }
JsonRowDeserializationSchema implements DeserializationSchema<Row> { @Override public Row deserialize(byte[] message) throws IOException { try { final JsonNode root = objectMapper.readTree(message); return convertRow(root, (RowTypeInfo) typeInfo); } catch (Throwable t) { throw new IOException("Failed to deserialize JSON object.", t); } } JsonRowDeserializationSchema(TypeInformation<Row> typeInfo);  JsonRowDeserializationSchema(String jsonSchema); @Override Row deserialize(byte[] message); @Override boolean isEndOfStream(Row nextElement); @Override TypeInformation<Row> getProducedType(); void setFailOnMissingField(boolean failOnMissingField); @Override boolean equals(Object o); @Override int hashCode(); }
JsonRowDeserializationSchema implements DeserializationSchema<Row> { @Override public Row deserialize(byte[] message) throws IOException { try { final JsonNode root = objectMapper.readTree(message); return convertRow(root, (RowTypeInfo) typeInfo); } catch (Throwable t) { throw new IOException("Failed to deserialize JSON object.", t); } } JsonRowDeserializationSchema(TypeInformation<Row> typeInfo);  JsonRowDeserializationSchema(String jsonSchema); @Override Row deserialize(byte[] message); @Override boolean isEndOfStream(Row nextElement); @Override TypeInformation<Row> getProducedType(); void setFailOnMissingField(boolean failOnMissingField); @Override boolean equals(Object o); @Override int hashCode();  }