LeonBein commented on a change in pull request #15109: URL: https://github.com/apache/flink/pull/15109#discussion_r596101204
########## File path: flink-connectors/flink-connector-hbase/src/main/java/org/apache/flink/connector/hbase/HBaseEvent.java ########## @@ -0,0 +1,98 @@ +/* + * 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.connector.hbase; + +import org.apache.flink.connector.hbase.sink.HBaseSinkSerializer; +import org.apache.flink.connector.hbase.source.HBaseSource; +import org.apache.flink.connector.hbase.source.reader.HBaseSourceEvent; + +import org.apache.hadoop.hbase.Cell; + +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; + +/** + * The base HBaseEvent which needs to be created in the {@link HBaseSinkSerializer} to write data to + * HBase. The subclass {@link HBaseSourceEvent} contains additional information and is used by the + * {@link HBaseSource} to represent an incoming event from HBase. + */ +public class HBaseEvent { + + public static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8; + + private final String rowId; + private final String cf; Review comment: ✅ in 5ba3ba8f10afffc296440e31b51eda0bc411ec22 ########## File path: flink-connectors/flink-connector-hbase/src/main/java/org/apache/flink/connector/hbase/HBaseEvent.java ########## @@ -0,0 +1,98 @@ +/* + * 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.connector.hbase; + +import org.apache.flink.connector.hbase.sink.HBaseSinkSerializer; +import org.apache.flink.connector.hbase.source.HBaseSource; +import org.apache.flink.connector.hbase.source.reader.HBaseSourceEvent; + +import org.apache.hadoop.hbase.Cell; + +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; + +/** + * The base HBaseEvent which needs to be created in the {@link HBaseSinkSerializer} to write data to + * HBase. The subclass {@link HBaseSourceEvent} contains additional information and is used by the + * {@link HBaseSource} to represent an incoming event from HBase. + */ +public class HBaseEvent { + + public static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8; + + private final String rowId; + private final String cf; + private final String qualifier; + private final byte[] payload; + private final Cell.Type type; + + protected HBaseEvent( + Cell.Type type, String rowId, String cf, String qualifier, byte[] payload) { + this.rowId = rowId; + this.cf = cf; + this.qualifier = qualifier; + this.payload = payload; + this.type = type; + } + + public static HBaseEvent deleteWith(String rowId, String cf, String qualifier) { + return new HBaseEvent(Cell.Type.Delete, rowId, cf, qualifier, null); + } + + public static HBaseEvent putWith(String rowId, String cf, String qualifier, byte[] payload) { + return new HBaseEvent(Cell.Type.Put, rowId, cf, qualifier, payload); + } + + @Override + public String toString() { + return type.name() + " " + rowId + " " + cf + " " + qualifier + " " + new String(payload); + } + + public Cell.Type getType() { + return type; + } + + public byte[] getPayload() { + return payload; + } + + public String getRowId() { + return rowId; + } + + public String getCf() { + return cf; + } + + public String getQualifier() { + return qualifier; + } + + public byte[] getRowIdBytes() { + return rowId.getBytes(DEFAULT_CHARSET); + } + + public byte[] getCfBytes() { Review comment: ✅ in 5ba3ba8f10afffc296440e31b51eda0bc411ec22 ---------------------------------------------------------------- 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