/** * Encodes the provided row into a partition key according to the partition schema. * * @param row the row to encode * @param partitionSchema the partition schema describing the table's partitioning * @return an encoded partition key */ public static byte[] encodePartitionKey(PartialRow row, PartitionSchema partitionSchema) { ByteVec buf = ByteVec.create(); if (!partitionSchema.getHashBucketSchemas().isEmpty()) { for (final HashBucketSchema hashSchema : partitionSchema.getHashBucketSchemas()) { encodeHashBucket(getHashBucket(row, hashSchema), buf); } } encodeColumns(row, partitionSchema.getRangeSchema().getColumns(), buf); return buf.toArray(); }
ByteVec lower = partitionKeyRange.getFirst().clone(); ByteVec upper = partitionKeyRange.getFirst().clone(); KeyEncoder.encodeHashBucket(bucket, lower); KeyEncoder.encodeHashBucket(bucketUpper, upper); newPartitionKeyRanges.add(new Pair<>(lower, upper));