siddharthteotia commented on code in PR #9333:
URL: https://github.com/apache/pinot/pull/9333#discussion_r988644335
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/TableConfigUtils.java:
##########
@@ -897,6 +903,40 @@ private static void validateFieldConfigList(@Nullable
List<FieldConfig> fieldCon
}
}
+ /**
+ * Validates the compatibility of the indexes if the column has the forward
index disabled. Throws exceptions due to
+ * compatibility mismatch. The checks performed are:
+ * - Validate dictionary is enabled.
+ * - Validate inverted index is enabled.
+ * - Validate that either no range index exists for column or the range
index version is at least 2 and isn't a
+ * multi-value column (since mulit-value defaults to index v1).
+ */
+ private static void validateForwardIndexDisabledIndexCompatibility(String
columnName, FieldConfig fieldConfig,
+ IndexingConfig indexingConfigs, List<String> noDictionaryColumns, Schema
schema) {
+ Map<String, String> fieldConfigProperties = fieldConfig.getProperties();
+ if (fieldConfigProperties == null) {
+ return;
+ }
+
+ boolean forwardIndexDisabled =
Boolean.parseBoolean(fieldConfigProperties.get(FieldConfig.FORWARD_INDEX_DISABLED));
+ if (!forwardIndexDisabled) {
+ return;
+ }
+
+ FieldSpec fieldSpec = schema.getFieldSpecFor(columnName);
+ Preconditions.checkState(noDictionaryColumns == null ||
!noDictionaryColumns.contains(columnName),
+ String.format("Forward index disabled column %s must have dictionary
enabled", columnName));
+ Preconditions.checkState(indexingConfigs.getInvertedIndexColumns() != null
+ && indexingConfigs.getInvertedIndexColumns().contains(columnName),
+ String.format("Forward index disabled column %s must have inverted
index enabled", columnName));
+ Preconditions.checkState(indexingConfigs.getRangeIndexColumns() == null
Review Comment:
(nit) This check can be cleaned up / broken into 2 checks to make code
readable
--
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]