beryllw commented on code in PR #2485: URL: https://github.com/apache/fluss/pull/2485#discussion_r2741548267
########## fluss-common/src/main/java/org/apache/fluss/row/decode/KeyDecoder.java: ########## @@ -0,0 +1,45 @@ +/* + * 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.fluss.row.decode; + +import org.apache.fluss.row.InternalRow; +import org.apache.fluss.types.RowType; + +import java.util.List; + +/** + * Interface for decoding key bytes back to {@link InternalRow}. + * + * <p>This interface provides functionality to decode compacted key bytes into internal row + * representation, typically used for primary key decoding in KV tables. + */ +public interface KeyDecoder { + /** Decode key bytes to a row containing only key fields, without non-key fields. */ + InternalRow decodeKey(byte[] keyBytes); + + /** + * Create a key decoder to decode the key array bytes of the input row. + * + * @param rowType the row type of the input row + * @param keyFields the key fields to decode + */ + static KeyDecoder of(RowType rowType, List<String> keyFields) { + return CompactedKeyDecoder.createKeyDecoder(rowType, keyFields); Review Comment: Will add KeyDecoders for Paimon and Iceberg later. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
