frankxieke commented on a change in pull request #13094:
URL: https://github.com/apache/pulsar/pull/13094#discussion_r763578352



##########
File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/generic/MultiVersionGenericProtobufReader.java
##########
@@ -0,0 +1,90 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pulsar.client.impl.schema.generic;
+
+import com.google.protobuf.Descriptors;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.avro.Schema;
+import org.apache.avro.protobuf.ProtobufData;
+import org.apache.pulsar.client.api.SchemaSerializationException;
+import org.apache.pulsar.client.api.schema.GenericRecord;
+import org.apache.pulsar.client.api.schema.SchemaReader;
+import org.apache.pulsar.client.impl.schema.SchemaUtils;
+import org.apache.pulsar.client.impl.schema.reader.AbstractMultiVersionReader;
+import org.apache.pulsar.common.protocol.schema.BytesSchemaVersion;
+import org.apache.pulsar.common.schema.SchemaInfo;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.nio.charset.StandardCharsets;
+
+@Slf4j
+public class MultiVersionGenericProtobufReader extends 
AbstractMultiVersionReader<GenericRecord>
+        implements SchemaReader<GenericRecord> {
+
+    private final boolean useProvidedSchemaAsReaderSchema;
+    private final SchemaInfo schemaInfo;
+    private final Descriptors.Descriptor descriptor;
+
+
+    public MultiVersionGenericProtobufReader(boolean 
useProvidedSchemaAsReaderSchema,
+                                             SchemaInfo schemaInfo) {
+        super(new 
GenericProtobufReader(parseAvroBaseSchemaToProtobuf(schemaInfo)));

Review comment:
       parseAvroBaseSchemaToProtobuf will be called two times.




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

To unsubscribe, e-mail: commits-unsubscr...@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to