Skip to content

Commit

Permalink
Convert typeStrategies from list to array
Browse files Browse the repository at this point in the history
  • Loading branch information
Akshat-Jain committed Jul 24, 2024
1 parent ff91346 commit 722e25b
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public class WindowOperatorQueryFrameProcessor implements FrameProcessor<Object>

// List of type strategies to compare the partition columns across rows.
// Type strategies are pushed in the same order as column types in frameReader.signature()
private final List<NullableTypeStrategy<Object>> typeStrategies = new ArrayList<>();
private final NullableTypeStrategy[] typeStrategies;

public WindowOperatorQueryFrameProcessor(
WindowOperatorQuery query,
Expand Down Expand Up @@ -115,8 +115,9 @@ public WindowOperatorQueryFrameProcessor(
this.partitionColumnNames = partitionColumnNames;

this.frameReader = frameReader;
this.typeStrategies = new NullableTypeStrategy[frameReader.signature().size()];
for (int i = 0; i < frameReader.signature().size(); i++) {
typeStrategies.add(frameReader.signature().getColumnType(i).get().getNullableStrategy());
typeStrategies[i] = frameReader.signature().getColumnType(i).get().getNullableStrategy();
}
}

Expand Down Expand Up @@ -507,7 +508,7 @@ private boolean comparePartitionKeys(ResultRow row1, ResultRow row2, List<String
int match = 0;
for (String columnName : partitionColumnNames) {
int i = frameReader.signature().indexOf(columnName);
if (typeStrategies.get(i).compare(row1.get(i), row2.get(i)) == 0) {
if (typeStrategies[i].compare(row1.get(i), row2.get(i)) == 0) {
match++;
}
}
Expand Down

0 comments on commit 722e25b

Please sign in to comment.