vvivekiyer commented on code in PR #9678:
URL: https://github.com/apache/pinot/pull/9678#discussion_r1011009045


##########
pinot-segment-local/src/test/java/org/apache/pinot/segment/local/segment/index/loader/ForwardIndexHandlerTest.java:
##########
@@ -302,34 +351,54 @@ public void testComputeOperation()
 
     // TEST1 : Validate with zero changes. ForwardIndexHandler should be a 
No-Op.
     IndexLoadingConfig indexLoadingConfig = new IndexLoadingConfig(null, 
_tableConfig);
-    ForwardIndexHandler fwdIndexHandler = new 
ForwardIndexHandler(existingSegmentMetadata, indexLoadingConfig);
+    ForwardIndexHandler fwdIndexHandler = new 
ForwardIndexHandler(existingSegmentMetadata, indexLoadingConfig, null);
     Map<String, ForwardIndexHandler.Operation> operationMap = new HashMap<>();
     operationMap = fwdIndexHandler.computeOperation(writer);
     assertEquals(operationMap, Collections.EMPTY_MAP);
 
-    // TEST2: Enable dictionary for a RAW_ZSTANDARD_INDEX_COLUMN. 
ForwardIndexHandler should be a No-Op.
+    // TEST2: Enable dictionary for a RAW_ZSTANDARD_INDEX_COLUMN.
     indexLoadingConfig = new IndexLoadingConfig(null, _tableConfig);
     indexLoadingConfig.getNoDictionaryColumns().remove(DIM_ZSTANDARD_STRING);
-    fwdIndexHandler = new ForwardIndexHandler(existingSegmentMetadata, 
indexLoadingConfig);
+    fwdIndexHandler = new ForwardIndexHandler(existingSegmentMetadata, 
indexLoadingConfig, _schema);
+    operationMap = fwdIndexHandler.computeOperation(writer);
+    assertEquals(operationMap.get(DIM_ZSTANDARD_STRING), 
ForwardIndexHandler.Operation.ENABLE_DICTIONARY);
+
+    // TEST3: Enable dictionary for an MV column.
+    indexLoadingConfig = new IndexLoadingConfig(null, _tableConfig);
+    
indexLoadingConfig.getNoDictionaryColumns().remove(DIM_MV_PASS_THROUGH_STRING);
+    fwdIndexHandler = new ForwardIndexHandler(existingSegmentMetadata, 
indexLoadingConfig, _schema);
+    operationMap = fwdIndexHandler.computeOperation(writer);
+    assertEquals(operationMap.get(DIM_MV_PASS_THROUGH_STRING), 
ForwardIndexHandler.Operation.ENABLE_DICTIONARY);
+
+    // TEST4: Enable dictionary for a sorted column.
+    indexLoadingConfig = new IndexLoadingConfig(null, _tableConfig);
+    
indexLoadingConfig.getNoDictionaryColumns().remove(DIM_PASS_THROUGH_SORTED_LONG);
+    fwdIndexHandler = new ForwardIndexHandler(existingSegmentMetadata, 
indexLoadingConfig, _schema);
+    operationMap = fwdIndexHandler.computeOperation(writer);
+    assertEquals(operationMap.get(DIM_PASS_THROUGH_SORTED_LONG), 
ForwardIndexHandler.Operation.ENABLE_DICTIONARY);
+
+    // TEST5: Enable dictionary for a dict column. Should be a No-op.
+    indexLoadingConfig = new IndexLoadingConfig(null, _tableConfig);
+    fwdIndexHandler = new ForwardIndexHandler(existingSegmentMetadata, 
indexLoadingConfig, _schema);
     operationMap = fwdIndexHandler.computeOperation(writer);
     assertEquals(operationMap, Collections.EMPTY_MAP);
 
-    // TEST3: Disable dictionary. ForwardIndexHandler should be a No-Op.
+    // TEST6: Disable dictionary. Should be a No-op.
     indexLoadingConfig = new IndexLoadingConfig(null, _tableConfig);
     indexLoadingConfig.getNoDictionaryColumns().add(DIM_DICT_INTEGER);
-    fwdIndexHandler = new ForwardIndexHandler(existingSegmentMetadata, 
indexLoadingConfig);
+    fwdIndexHandler = new ForwardIndexHandler(existingSegmentMetadata, 
indexLoadingConfig, null);
     operationMap = fwdIndexHandler.computeOperation(writer);
     assertEquals(operationMap, Collections.EMPTY_MAP);
 
-    // TEST4: Add an additional text index. ForwardIndexHandler should be a 
No-Op.
+    // TEST7: Add an additional text index. ForwardIndexHandler should be a 
No-Op.
     indexLoadingConfig = new IndexLoadingConfig(null, _tableConfig);
     indexLoadingConfig.getTextIndexColumns().add(DIM_DICT_INTEGER);
     indexLoadingConfig.getTextIndexColumns().add(DIM_LZ4_INTEGER);
-    fwdIndexHandler = new ForwardIndexHandler(existingSegmentMetadata, 
indexLoadingConfig);
+    fwdIndexHandler = new ForwardIndexHandler(existingSegmentMetadata, 
indexLoadingConfig, null);

Review Comment:
   Tested in SegmentPreProcessorTest. Also added a test here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to