icefury71 commented on a change in pull request #6541:
URL: https://github.com/apache/incubator-pinot/pull/6541#discussion_r574179544



##########
File path: 
pinot-core/src/main/java/org/apache/pinot/core/util/TableConfigUtils.java
##########
@@ -474,11 +478,48 @@ private static void validateIndexingConfig(@Nullable 
IndexingConfig indexingConf
       Preconditions.checkState(schema.getFieldSpecFor(columnName) != null,
           "Column Name " + columnName + " defined in " + configName + " must 
be a valid column defined in the schema");
     }
+
+    // Range index semantic validation
+    // Range index can be defined on numeric columns and any column with a 
dictionary
+    if (indexingConfig.getRangeIndexColumns() != null) {
+      for (String rangeIndexCol : indexingConfig.getRangeIndexColumns()) {
+        Preconditions.checkState(
+            schema.getFieldSpecFor(rangeIndexCol).getDataType().isNumeric() || 
!noDictionaryColumnsSet
+                .contains(rangeIndexCol),
+            "Cannot create a range index on non-numeric/no-dictionary column " 
+ rangeIndexCol);
+      }
+    }
+
+    // Var length dictionary semantic validation
+    if (indexingConfig.getVarLengthDictionaryColumns() != null) {
+      for (String varLenDictCol : 
indexingConfig.getVarLengthDictionaryColumns()) {
+        FieldSpec varLenDictFieldSpec = schema.getFieldSpecFor(varLenDictCol);
+        switch (varLenDictFieldSpec.getDataType()) {
+          case STRING:
+          case BYTES:
+            continue;
+          default:
+            throw new IllegalStateException(
+                "var length dictionary can only be created for columns of type 
STRING and BYTES. Invalid for column "

Review comment:
       I suppose multi-value columns should be ok here - not really related to 
the encoding. 




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to