tsreaper commented on code in PR #5537: URL: https://github.com/apache/paimon/pull/5537#discussion_r2059906394
########## paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/lookup/FixedBucketFromPkExtractor.java: ########## @@ -62,49 +49,16 @@ public FixedBucketFromPkExtractor(TableSchema schema) { schema.trimmedPrimaryKeys().stream() .mapToInt(schema.primaryKeys()::indexOf) .toArray()); - this.partitionProjection = - CodeGenUtils.newProjection( - schema.logicalPrimaryKeysType(), - schema.partitionKeys().stream() - .mapToInt(schema.primaryKeys()::indexOf) - .toArray()); - this.logPrimaryKeyProjection = - CodeGenUtils.newProjection( - schema.logicalRowType(), schema.projection(schema.primaryKeys())); } - @Override - public void setRecord(InternalRow record) { - this.primaryKey = record; - } - - @Override - public BinaryRow partition() { - return partitionProjection.apply(primaryKey); - } - - private BinaryRow bucketKey() { + public int bucket(int numBuckets, InternalRow primaryKey) { + BinaryRow bucketKey; if (sameBucketKeyAndTrimmedPrimaryKey) { - return trimmedPrimaryKey(); + bucketKey = trimmedPrimaryKeyProjection.apply(primaryKey); Review Comment: No need for this check. Unlike `KeyAndBucketExtractor`, trimmed primary key is not needed in this class. Actually, why do you need two classes to implement this? Just put all these code into `PrimaryKeyPartialLookupTable`. -- 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: issues-unsubscr...@paimon.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org