This is an automated email from the ASF dual-hosted git repository.
tingchen 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 c244cd38fa9 [Timeseries-storage] add DeltaDelta/Delta compressionCodec
table config validation (#17252)
c244cd38fa9 is described below
commit c244cd38fa93c8cc39d26f54ef6126964dd98d8d
Author: Qiaochu Liu <[email protected]>
AuthorDate: Tue Jan 13 14:38:02 2026 -0800
[Timeseries-storage] add DeltaDelta/Delta compressionCodec table config
validation (#17252)
---
.../segment/local/utils/TableConfigUtils.java | 23 ++++++++++++++++++++++
.../segment/local/utils/TableConfigUtilsTest.java | 20 +++++++++++++++++++
2 files changed, 43 insertions(+)
diff --git
a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/TableConfigUtils.java
b/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/TableConfigUtils.java
index 731cc6968fa..dc04193737c 100644
---
a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/TableConfigUtils.java
+++
b/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/TableConfigUtils.java
@@ -1245,6 +1245,9 @@ public final class TableConfigUtils {
for (FieldConfig fieldConfig : fieldConfigs) {
String column = fieldConfig.getName();
Preconditions.checkState(schema.hasColumn(column), "Failed to find
column: %s in schema", column);
+
+ // Validate DELTA / DELTADELTA compression codecs compatibility
+ validateGorillaCompressionCodecIfPresent(fieldConfig,
schema.getFieldSpecFor(column));
}
validateIndexingConfigAndFieldConfigListCompatibility(indexingConfig,
fieldConfigs);
}
@@ -1930,4 +1933,24 @@ public final class TableConfigUtils {
getRelevantTags(tableConfig).stream().map(TagNameUtils::getTenantFromTag).collect(Collectors.toSet());
return relevantTenants.contains(tenantName);
}
+
+ private static void validateGorillaCompressionCodecIfPresent(FieldConfig
fieldConfig, FieldSpec fieldSpec) {
+ if (fieldConfig.getCompressionCodec() == null) {
+ return;
+ }
+ switch (fieldConfig.getCompressionCodec()) {
+ case DELTA:
+ case DELTADELTA:
+ Preconditions.checkState(fieldSpec.isSingleValueField(),
+ "Compression codec %s can only be used on single-value columns,
found multi-value column: %s",
+ fieldConfig.getCompressionCodec(), fieldConfig.getName());
+ DataType storedType = fieldSpec.getDataType().getStoredType();
+ Preconditions.checkState(storedType == DataType.INT || storedType ==
DataType.LONG,
+ "Compression codec %s can only be used on INT/LONG data types,
found %s for column: %s",
+ fieldConfig.getCompressionCodec(), storedType,
fieldConfig.getName());
+ break;
+ default:
+ // no-op for other codecs
+ }
+ }
}
diff --git
a/pinot-segment-local/src/test/java/org/apache/pinot/segment/local/utils/TableConfigUtilsTest.java
b/pinot-segment-local/src/test/java/org/apache/pinot/segment/local/utils/TableConfigUtilsTest.java
index 0b04e4e33c2..ceb7df1d163 100644
---
a/pinot-segment-local/src/test/java/org/apache/pinot/segment/local/utils/TableConfigUtilsTest.java
+++
b/pinot-segment-local/src/test/java/org/apache/pinot/segment/local/utils/TableConfigUtilsTest.java
@@ -1173,6 +1173,26 @@ public class TableConfigUtilsTest {
fail("all nullable fields set for fieldConfig should pass", e);
}
+ try {
+ FieldConfig fieldConfig =
+ new FieldConfig("myCol1", FieldConfig.EncodingType.RAW, null, null,
CompressionCodec.DELTADELTA, null, null);
+ tableConfig.setFieldConfigList(Arrays.asList(fieldConfig));
+ TableConfigUtils.validate(tableConfig, schema);
+ } catch (Exception e) {
+ assertEquals(e.getMessage(),
+ "Compression codec DELTADELTA can only be used on INT/LONG data
types, found STRING for column: myCol1");
+ }
+
+ try {
+ FieldConfig fieldConfig =
+ new FieldConfig("myCol2", FieldConfig.EncodingType.RAW, null, null,
CompressionCodec.DELTADELTA, null, null);
+ tableConfig.setFieldConfigList(Arrays.asList(fieldConfig));
+ TableConfigUtils.validate(tableConfig, schema);
+ } catch (Exception e) {
+ assertEquals(e.getMessage(),
+ "Compression codec DELTADELTA can only be used on single-value
columns, found multi-value column: myCol2");
+ }
+
try {
FieldConfig fieldConfig =
new FieldConfig("myCol1", FieldConfig.EncodingType.DICTIONARY,
FieldConfig.IndexType.FST, null, null);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]