Skip to content

Commit

Permalink
Fix test nits.
Browse files Browse the repository at this point in the history
  • Loading branch information
rdblue committed Dec 20, 2024
1 parent 2a906ec commit 7312f19
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
8 changes: 2 additions & 6 deletions api/src/test/java/org/apache/iceberg/util/RandomUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ public class RandomUtil {

private RandomUtil() {}

public static String generateString(int length, Random random) {
return randomString(length, random);
}

private static boolean negate(int num) {
return num % 2 == 1;
}
Expand Down Expand Up @@ -204,10 +200,10 @@ public static Object generateDictionaryEncodablePrimitive(
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-.!?";

private static String randomString(Random random) {
return randomString(random.nextInt(50), random);
return generateString(random.nextInt(50), random);
}

private static String randomString(int length, Random random) {
public static String generateString(int length, Random random) {
byte[] buffer = new byte[length];

for (int i = 0; i < length; i += 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package org.apache.iceberg.variants;

import java.util.NoSuchElementException;

/** A variant metadata dictionary. */
public interface VariantMetadata extends Variants.Serialized {
/** Returns the ID for a {@code name} in the dictionary, or -1 if not present. */
Expand All @@ -26,7 +28,7 @@ public interface VariantMetadata extends Variants.Serialized {
/**
* Returns the field name for an ID in metadata.
*
* @throws ArrayIndexOutOfBoundsException if the dictionary does not contain the ID
* @throws NoSuchElementException if the dictionary does not contain the ID
*/
String get(int id);
}
Original file line number Diff line number Diff line change
Expand Up @@ -395,15 +395,15 @@ public void testThreeByteFieldIds(boolean sortFieldNames) {
assertThat(object.get("ZZ").asPrimitive().get()).isEqualTo(new BigDecimal("12.21"));
}

static VariantValue roundTripMinimalBuffer(ShreddedObject object, SerializedMetadata metadata) {
private static VariantValue roundTripMinimalBuffer(ShreddedObject object, SerializedMetadata metadata) {
ByteBuffer serialized =
ByteBuffer.allocate(object.sizeInBytes()).order(ByteOrder.LITTLE_ENDIAN);
object.writeTo(serialized, 0);

return Variants.from(metadata, serialized);
}

static VariantValue roundTripLargeBuffer(ShreddedObject object, SerializedMetadata metadata) {
private static VariantValue roundTripLargeBuffer(ShreddedObject object, SerializedMetadata metadata) {
ByteBuffer serialized =
ByteBuffer.allocate(1000 + object.sizeInBytes()).order(ByteOrder.LITTLE_ENDIAN);
object.writeTo(serialized, 300);
Expand Down

0 comments on commit 7312f19

Please sign in to comment.