This is an automated email from the ASF dual-hosted git repository.
Jackie-Jiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push:
new 4b27e222363 Reject range index on a raw BIG_DECIMAL column during
table config validation (#20376)
4b27e222363 is described below
commit 4b27e2223630d15d73ec992525d031a56dd80e9e
Author: Deshmukh P <[email protected]>
AuthorDate: Wed Nov 25 11:00:32 2026 +0530
Reject range index on a raw BIG_DECIMAL column during table config
validation (#20376)
---
.../src/test/resources/TableIndexingTest.csv | 2 +-
.../local/segment/index/range/RangeIndexType.java | 5 ++++
.../utils/IndexCombinationValidationTest.java | 34 ++++++++++++++++++++++
3 files changed, 40 insertions(+), 1 deletion(-)
diff --git a/pinot-core/src/test/resources/TableIndexingTest.csv
b/pinot-core/src/test/resources/TableIndexingTest.csv
index 01ea7b7fee6..8eff4ee62c7 100644
--- a/pinot-core/src/test/resources/TableIndexingTest.csv
+++ b/pinot-core/src/test/resources/TableIndexingTest.csv
@@ -182,7 +182,7 @@ DECIMAL;sv_BIG;raw;h3_index;false;Cannot create H3 index on
column: col of store
DECIMAL;sv_BIG;raw;inverted_index;false;Cannot create inverted index on
column: col without dictionary
DECIMAL;sv_BIG;raw;json_index;false;Cannot create JSON index on column: col of
stored type other than STRING or MAP
DECIMAL;sv_BIG;raw;text_index;false;Cannot create TEXT index on column: col of
stored type other than STRING
-DECIMAL;sv_BIG;raw;range_index;false;Unsupported data type: BIG_DECIMAL
+DECIMAL;sv_BIG;raw;range_index;false;Cannot create range index on BIG_DECIMAL
column: col without dictionary
DECIMAL;sv_BIG;raw;startree_index;false;Cannot create star-tree index on
dimension column: col without dictionary
DECIMAL;sv_BIG;raw;vector_index;false;Cannot create vector index on
single-value column: col
DECIMAL;sv_BIG;raw;multi_col_text_index;false;Cannot create TEXT index on
column: col of stored type other than STRING
diff --git
a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/range/RangeIndexType.java
b/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/range/RangeIndexType.java
index 03c77cd1999..4ba33f9d6c3 100644
---
a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/range/RangeIndexType.java
+++
b/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/range/RangeIndexType.java
@@ -84,6 +84,11 @@ public class RangeIndexType
storedType.isNumeric() ||
indexConfigs.getConfig(StandardIndexes.dictionary()).isEnabled(),
"Cannot create range index on non-numeric column: %s without
dictionary", column);
Preconditions.checkState(storedType != DataType.MAP, "Cannot create
range index on MAP column: %s", column);
+ // BIG_DECIMAL is numeric, but neither range index creator can index its
raw values; they can only index it
+ // through dictionary ids.
+ Preconditions.checkState(
+ storedType != DataType.BIG_DECIMAL ||
indexConfigs.getConfig(StandardIndexes.dictionary()).isEnabled(),
+ "Cannot create range index on BIG_DECIMAL column: %s without
dictionary", column);
// Legacy range index (version 1) over dict IDs is non-exact: query-time
partial matches fall back to
// ScanBasedFilterOperator, which on a RAW forward column would have to
apply a dict-based evaluator
// against raw values — silently producing wrong results. Reject this
combination upfront and require
diff --git
a/pinot-segment-local/src/test/java/org/apache/pinot/segment/local/utils/IndexCombinationValidationTest.java
b/pinot-segment-local/src/test/java/org/apache/pinot/segment/local/utils/IndexCombinationValidationTest.java
index 80d18b6d615..aaa15ecb80a 100644
---
a/pinot-segment-local/src/test/java/org/apache/pinot/segment/local/utils/IndexCombinationValidationTest.java
+++
b/pinot-segment-local/src/test/java/org/apache/pinot/segment/local/utils/IndexCombinationValidationTest.java
@@ -56,6 +56,7 @@ public class IndexCombinationValidationTest {
private static final String INT_COL = "intCol"; // INT SV
private static final String INT_MV_COL = "intMvCol"; // INT MV
private static final String FLOAT_COL = "floatCol"; // FLOAT SV
+ private static final String BIG_DECIMAL_COL = "bigDecimalCol"; //
BIG_DECIMAL SV
private static final Schema SCHEMA = new Schema.SchemaBuilder()
.setSchemaName(TABLE_NAME)
@@ -63,6 +64,7 @@ public class IndexCombinationValidationTest {
.addSingleValueDimension(INT_COL, DataType.INT)
.addMultiValueDimension(INT_MV_COL, DataType.INT)
.addSingleValueDimension(FLOAT_COL, DataType.FLOAT)
+ .addSingleValueDimension(BIG_DECIMAL_COL, DataType.BIG_DECIMAL)
.build();
// ----- helpers -----
@@ -351,6 +353,38 @@ public class IndexCombinationValidationTest {
assertValid(tc);
}
+ @Test
+ public void testDictWithRangeIndexBigDecimalColumnPasses() {
+ // dict-encoded BIG_DECIMAL + range: the range index is built over
dictionary ids
+ TableConfig tc = new
TableConfigBuilder(TableType.OFFLINE).setTableName(TABLE_NAME)
+ .setRangeIndexColumns(List.of(BIG_DECIMAL_COL))
+ .build();
+ assertValid(tc);
+ }
+
+ @Test
+ public void testRawWithRangeIndexBigDecimalColumnNoDictFails() {
+ // RAW BIG_DECIMAL + range without dict: BIG_DECIMAL is numeric, but
neither range index creator supports raw
+ // BIG_DECIMAL values, so segment creation would fail
+ TableConfig tc = new
TableConfigBuilder(TableType.OFFLINE).setTableName(TABLE_NAME)
+ .setNoDictionaryColumns(List.of(BIG_DECIMAL_COL))
+ .setRangeIndexColumns(List.of(BIG_DECIMAL_COL))
+ .build();
+ assertInvalid(tc, "Cannot create range index on BIG_DECIMAL column");
+ }
+
+ @Test
+ public void testRawWithRangeIndexBigDecimalColumnWithExplicitDictPasses() {
+ ObjectNode indexes = JsonUtils.newObjectNode();
+ indexes.set("dictionary", JsonUtils.newObjectNode());
+ FieldConfig fc = new FieldConfig(BIG_DECIMAL_COL, EncodingType.RAW, null,
null, null, null, indexes, null, null);
+ TableConfig tc = new
TableConfigBuilder(TableType.OFFLINE).setTableName(TABLE_NAME)
+ .setRangeIndexColumns(List.of(BIG_DECIMAL_COL))
+ .setFieldConfigList(List.of(fc))
+ .build();
+ assertValid(tc);
+ }
+
// ============================================================
// 6. Multi-value column combinations
// ============================================================
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]