becketqin commented on a change in pull request #6594: [FLINK-9311] [pubsub] Added PubSub source connector with support for checkpointing (ATLEAST_ONCE) URL: https://github.com/apache/flink/pull/6594#discussion_r282448138
########## File path: flink-connectors/flink-connector-gcp-pubsub/src/main/java/org/apache/flink/streaming/connectors/gcp/pubsub/common/PubSubDeserializationSchema.java ########## @@ -0,0 +1,52 @@ +/* + * 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.flink.streaming.connectors.gcp.pubsub.common; + +import org.apache.flink.api.java.typeutils.ResultTypeQueryable; + +import com.google.pubsub.v1.PubsubMessage; + +import java.io.Serializable; + +/** + * The deserialization schema describes how to turn the PubsubMessages + * into data types (Java/Scala objects) that are processed by Flink. + * + * @param <T> The type created by the deserialization schema. + */ +public interface PubSubDeserializationSchema<T> extends Serializable, ResultTypeQueryable<T> { Review comment: I had the same question in the first round of review and I think it is because the deserializer does not (only) take `byte[]` as input, which is unlike the `DeserializationSchema`. There are some potential benefits to use `PubSubMessage` as the input. For example, while the `data` field in the `PubSubMessage` could be converted to a byte array, it will introduce an additional memory copy. Another example is that if the deserialization depends on the attribute in the PubSubMessage (e.g. compression type, encryption hint, etc.), only passing the data bytes to the deserializer may not work. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services