xiangfu0 commented on code in PR #18480:
URL: https://github.com/apache/pinot/pull/18480#discussion_r3337351722


##########
pinot-segment-local/src/test/java/org/apache/pinot/segment/local/segment/index/loader/IndexLoadingConfigTest.java:
##########
@@ -157,6 +161,62 @@ public void testCalculateIndexConfigsWithTierOverwrites()
     assertFalse(fieldCfgs.getConfig(StandardIndexes.dictionary()).isEnabled());
   }
 
+  @Test
+  public void testReservedConsumingTierIsNotAppliedAsStorageTier()
+      throws IOException {
+    assertTierStorageSemantics(TableType.REALTIME, "consuming", false, false);
+    assertTierStorageSemantics(TableType.REALTIME, "completed", false, false);
+    assertTierStorageSemantics(TableType.OFFLINE, "completed", true, false);
+    assertTierStorageSemantics(TableType.REALTIME, "coldTier", true, true);
+  }
+
+  @Test
+  public void testExistingConsumingStorageTierStillApplies()
+      throws IOException {
+    assertTierStorageSemantics(TableType.REALTIME, "consuming", true, true);
+  }
+
+  private static void assertTierStorageSemantics(TableType tableType, String 
tier, boolean hasRealTierConfig,
+      boolean expectedTierOverwriteApplied)
+      throws IOException {
+    Schema schema =
+        new 
Schema.SchemaBuilder().setSchemaName(TABLE_NAME).addSingleValueDimension("col1",
 FieldSpec.DataType.STRING)
+            .build();
+    FieldConfig col1Cfg = fieldConfigWithTierOverwrite(tier);
+    TableConfigBuilder tableConfigBuilder = new 
TableConfigBuilder(tableType).setTableName(TABLE_NAME)
+        .setNoDictionaryColumns(List.of("col1"))
+        .setTierOverwrites(JsonUtils.stringToJsonNode("{\"" + tier + "\": 
{\"noDictionaryColumns\": []}}"))
+        .setFieldConfigList(List.of(col1Cfg));
+    if (hasRealTierConfig) {
+      tableConfigBuilder.setTierConfigList(List.of(new TierConfig(tier, 
TierFactory.TIME_SEGMENT_SELECTOR_TYPE, "30d",
+          null, TierFactory.PINOT_SERVER_STORAGE_TYPE, tier + "_tag_" + 
tableType, null, null)));
+    }
+    TableConfig tableConfig = tableConfigBuilder.build();
+
+    IndexLoadingConfig ilc = new IndexLoadingConfig(tableConfig, schema);
+    ilc.setSegmentTier(tier);
+
+    FieldIndexConfigs fieldCfgs = ilc.getFieldIndexConfig("col1");
+    
assertEquals(fieldCfgs.getConfig(StandardIndexes.dictionary()).isEnabled(), 
expectedTierOverwriteApplied);
+    assertEquals(fieldCfgs.getConfig(StandardIndexes.inverted()).isEnabled(), 
expectedTierOverwriteApplied);
+  }
+
+  private static FieldConfig fieldConfigWithTierOverwrite(String tier)
+      throws IOException {
+    return JsonUtils.stringToObject("{"
+        + "  \"name\": \"col1\","
+        + "  \"encodingType\": \"RAW\","
+        + "  \"tierOverwrites\": {"
+        + "    \"" + tier + "\": {"
+        + "      \"encodingType\": \"DICTIONARY\","
+        + "      \"indexes\": {"
+        + "        \"inverted\": {\"enabled\": \"true\"}"
+        + "      }"

Review Comment:
   Fixed in the amended push by changing the test JSON to use a boolean 
literal: `"enabled": true`.



-- 
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