Skip to content

Commit

Permalink
Patch for preserving addTypeIndex's additive behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunjeet committed Jul 20, 2023
1 parent dd183c9 commit 1df2e1d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,16 @@ public void addTypeIndex(PrimaryKey primaryKey) {
}

public HollowHistoryTypeKeyIndex addTypeIndex(PrimaryKey primaryKey, HollowDataset dataModel) {
HollowHistoryTypeKeyIndex prevKeyIdx = typeKeyIndexes.get(primaryKey.getType());
HollowHistoryTypeKeyIndex keyIdx = new HollowHistoryTypeKeyIndex(primaryKey, dataModel);
// retain any previous indexed fields
if (prevKeyIdx != null) {
for (int i = 0; i < prevKeyIdx.getKeyFields().length; i++) {
if (prevKeyIdx.getKeyFieldIsIndexed()[i]) {
keyIdx.addFieldIndex(prevKeyIdx.getKeyFields()[i], dataModel);
}
}
}
typeKeyIndexes.put(primaryKey.getType(), keyIdx);
return keyIdx;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ public String[] getKeyFields() {
return primaryKey.getFieldPaths();
}

public boolean[] getKeyFieldIsIndexed() {
return keyFieldIsIndexed;
}

public void addFieldIndex(String fieldName, HollowDataset dataModel) {
String[] fieldPathParts = PrimaryKey.getCompleteFieldPathParts(dataModel, primaryKey.getType(), fieldName);
for (int i = 0; i < primaryKey.numFields(); i++) {
Expand Down

0 comments on commit 1df2e1d

Please sign in to comment.