Skip to content

Commit

Permalink
Avoid retaining generated classes in TestFlatHashStrategy
Browse files Browse the repository at this point in the history
  • Loading branch information
pettyjamesm committed Nov 13, 2023
1 parent 5617bce commit 9ac52d5
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@

public class TestFlatHashStrategy
{
private static final TypeOperators TYPE_OPERATORS = new TypeOperators();
private static final JoinCompiler JOIN_COMPILER = new JoinCompiler(TYPE_OPERATORS);
private final TypeOperators typeOperators = new TypeOperators();
private final JoinCompiler joinCompiler = new JoinCompiler(typeOperators);

@Test
public void testBatchedRawHashesZeroLength()
{
List<Type> types = createTestingTypes();
FlatHashStrategy flatHashStrategy = JOIN_COMPILER.getFlatHashStrategy(types);
List<Type> types = createTestingTypes(typeOperators);
FlatHashStrategy flatHashStrategy = joinCompiler.getFlatHashStrategy(types);

int positionCount = 10;
// Attempting to touch any of the blocks would result in a NullPointerException
Expand All @@ -68,8 +68,8 @@ public void testBatchedRawHashesZeroLength()
@Test
public void testBatchedRawHashesMatchSinglePositionHashes()
{
List<Type> types = createTestingTypes();
FlatHashStrategy flatHashStrategy = JOIN_COMPILER.getFlatHashStrategy(types);
List<Type> types = createTestingTypes(typeOperators);
FlatHashStrategy flatHashStrategy = joinCompiler.getFlatHashStrategy(types);

int positionCount = 1024;
Block[] blocks = new Block[types.size()];
Expand Down Expand Up @@ -102,7 +102,7 @@ private static void assertHashesEqual(List<Type> types, Block[] blocks, long[] b
}
}

private static List<Type> createTestingTypes()
private static List<Type> createTestingTypes(TypeOperators typeOperators)
{
List<Type> baseTypes = List.of(
BIGINT,
Expand All @@ -128,7 +128,7 @@ private static List<Type> createTestingTypes()
builder.add(RowType.anonymous(baseTypes));
for (Type baseType : baseTypes) {
builder.add(new ArrayType(baseType));
builder.add(new MapType(baseType, baseType, TYPE_OPERATORS));
builder.add(new MapType(baseType, baseType, typeOperators));
}
return builder.build();
}
Expand Down

0 comments on commit 9ac52d5

Please sign in to comment.