diff --git a/hollow/src/main/java/com/netflix/hollow/tools/history/keyindex/HollowHistoryTypeKeyIndex.java b/hollow/src/main/java/com/netflix/hollow/tools/history/keyindex/HollowHistoryTypeKeyIndex.java index d6852bcb67..d7a5b8f6e3 100644 --- a/hollow/src/main/java/com/netflix/hollow/tools/history/keyindex/HollowHistoryTypeKeyIndex.java +++ b/hollow/src/main/java/com/netflix/hollow/tools/history/keyindex/HollowHistoryTypeKeyIndex.java @@ -19,7 +19,6 @@ import static com.netflix.hollow.core.HollowConstants.ORDINAL_NONE; import static com.netflix.hollow.tools.util.SearchUtils.MULTI_FIELD_KEY_DELIMITER; -import com.netflix.hollow.Hollow; import com.netflix.hollow.core.HollowDataset; import com.netflix.hollow.core.index.key.PrimaryKey; import com.netflix.hollow.core.memory.encoding.HashCodes; @@ -97,18 +96,20 @@ public void initializeKeySchema(HollowObjectTypeReadState initialTypeState) { if (isInitialized) return; HollowObjectSchema schema = initialTypeState.getSchema(); - for (String[] keyFieldPart : keyFieldNames) addSchemaField(schema, keyFieldPart, 0); + for (int i= 0; i < keyFieldNames.length; i ++) { + String[] keyFieldPart = keyFieldNames[i]; + fieldTypes[i] = addSchemaField(schema, keyFieldPart, 0); + } isInitialized = true; } - private void addSchemaField(HollowObjectSchema schema, String[] keyFieldNames, int keyFieldPartPosition) { + private FieldType addSchemaField(HollowObjectSchema schema, String[] keyFieldNames, int keyFieldPartPosition) { int schemaPosition = schema.getPosition(keyFieldNames[keyFieldPartPosition]); if (keyFieldPartPosition < keyFieldNames.length - 1) { HollowObjectSchema nextPartSchema = (HollowObjectSchema) schema.getReferencedTypeState(schemaPosition).getSchema(); - addSchemaField(nextPartSchema, keyFieldNames, keyFieldPartPosition + 1); - } else { - fieldTypes[keyFieldPartPosition] = schema.getFieldType(schemaPosition); + return addSchemaField(nextPartSchema, keyFieldNames, keyFieldPartPosition + 1); } + return schema.getFieldType(schemaPosition); } private void initializeKeyParts(HollowDataset dataModel) { diff --git a/hollow/src/main/java/com/netflix/hollow/tools/history/keyindex/HollowOrdinalMapper.java b/hollow/src/main/java/com/netflix/hollow/tools/history/keyindex/HollowOrdinalMapper.java index e7f0fea0e3..93d40fcc0b 100644 --- a/hollow/src/main/java/com/netflix/hollow/tools/history/keyindex/HollowOrdinalMapper.java +++ b/hollow/src/main/java/com/netflix/hollow/tools/history/keyindex/HollowOrdinalMapper.java @@ -16,14 +16,14 @@ */ package com.netflix.hollow.tools.history.keyindex; +import static com.netflix.hollow.core.HollowConstants.ORDINAL_NONE; + import com.netflix.hollow.core.index.key.PrimaryKey; import com.netflix.hollow.core.memory.encoding.HashCodes; import com.netflix.hollow.core.read.HollowReadFieldUtils; import com.netflix.hollow.core.read.engine.object.HollowObjectTypeReadState; import com.netflix.hollow.core.schema.HollowObjectSchema; import com.netflix.hollow.tools.util.ObjectInternPool; - -import static com.netflix.hollow.core.HollowConstants.ORDINAL_NONE; import java.util.Arrays; import java.util.HashMap; import java.util.Map;