merlimat commented on a change in pull request #1743: ByteBuffer schema URL: https://github.com/apache/incubator-pulsar/pull/1743#discussion_r186576446
########## File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/StringSchema.java ########## @@ -37,19 +37,16 @@ public StringSchema(Charset charset) { this.charset = charset; } - public byte[] encode(String message) { - return message.getBytes(charset); + public ByteBuffer encode(String message) { + byte[] bytes = message.getBytes(charset); + return ByteBuffer.allocateDirect(bytes.length).put(bytes); } - public String decode(byte[] bytes) { - return new String(bytes, charset); + public String decode(ByteBuffer buf) { + return new String(buf.array(), charset); } public SchemaInfo getSchemaInfo() { - SchemaInfo schemaInfo = new SchemaInfo(); - schemaInfo.setName("String"); - schemaInfo.setType(SchemaType.STRING); - schemaInfo.setSchema(new byte[0]); - return schemaInfo; + return null; Review comment: I think we should retain the schema info. It's marking that a particular topic is using "String" as the type. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services