Move ZNRecord SerDe into TableConfig and LogicalTableConfig#17678
Move ZNRecord SerDe into TableConfig and LogicalTableConfig#17678krishan1390 wants to merge 11 commits intoapache:masterfrom
Conversation
Move fromZNRecord/toZNRecord methods from TableConfigSerDeUtils and LogicalTableConfigUtils into the config classes themselves. This makes it easier to extend these classes — subclasses can override serialization/deserialization behavior directly. - Add helix-core dependency to pinot-spi for ZNRecord access - Add fromZNRecord()/toZNRecord() to TableConfig and LogicalTableConfig - Delete TableConfigSerDeUtils (all callers updated) - Remove fromZNRecord/toZNRecord from LogicalTableConfigUtils (validation stays) - Update all callers across 15 files to use the new methods directly Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
❌ 3 Tests Failed:
View the top 1 failed test(s) by shortest run time
View the full list of 3 ❄️ flaky test(s)
To view more test analytics, go to the Test Analytics Dashboard |
There was a problem hiding this comment.
Pull request overview
Moves ZNRecord serialization/deserialization responsibilities into TableConfig and LogicalTableConfig so serialization can be co-located with the config types (and toZNRecord() can be overridden by subclasses), removing the old utility-based SerDe entry points.
Changes:
- Added
fromZNRecord()/toZNRecord()toorg.apache.pinot.spi.config.table.TableConfigandorg.apache.pinot.spi.data.LogicalTableConfig - Removed
TableConfigSerDeUtilsand removed SerDe methods fromLogicalTableConfigUtils(kept validation) - Updated callers across tools, controller, common caches, and tests to use the new APIs
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/ValidateConfigCommand.java | Switches table config parsing to TableConfig.fromZNRecord() |
| pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/MoveReplicaGroup.java | Switches table config parsing to TableConfig.fromZNRecord() |
| pinot-tools/src/main/java/org/apache/pinot/tools/UpdateSegmentState.java | Switches table config parsing to TableConfig.fromZNRecord() |
| pinot-spi/src/main/java/org/apache/pinot/spi/data/LogicalTableConfig.java | Introduces fromZNRecord()/toZNRecord() for logical table configs |
| pinot-spi/src/main/java/org/apache/pinot/spi/config/table/TableConfig.java | Introduces fromZNRecord()/toZNRecord() for table configs |
| pinot-spi/pom.xml | Adds Helix dependency needed by ZNRecord APIs now in SPI |
| pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/test/java/.../RealtimeToOfflineSegmentsTaskExecutorTest.java | Updates tests to use tableConfig.toZNRecord() |
| pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/test/java/.../PurgeTaskExecutorTest.java | Updates tests to use tableConfig.toZNRecord() |
| pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/test/java/.../MergeRollupTaskExecutorTest.java | Updates tests to use tableConfig.toZNRecord() |
| pinot-perf/src/main/java/org/apache/pinot/perf/BenchmarkDimensionTableOverhead.java | Updates perf benchmark to use tableConfig.toZNRecord() |
| pinot-core/src/test/java/org/apache/pinot/core/data/manager/offline/DimensionTableDataManagerTest.java | Updates tests to use tableConfig.toZNRecord() |
| pinot-controller/src/test/java/org/apache/pinot/controller/api/TableSizeReaderTest.java | Updates tests to use tableConfig.toZNRecord() |
| pinot-controller/src/main/java/org/apache/pinot/controller/util/TableRetentionValidator.java | Switches table config parsing to TableConfig.fromZNRecord() |
| pinot-common/src/test/java/org/apache/pinot/common/utils/config/TableConfigSerDeUtilsTest.java | Repoints SerDe tests to TableConfig.fromZNRecord()/toZNRecord() |
| pinot-common/src/main/java/org/apache/pinot/common/utils/config/TableConfigSerDeUtils.java | Deletes table config utility SerDe |
| pinot-common/src/main/java/org/apache/pinot/common/utils/LogicalTableConfigUtils.java | Removes logical table utility SerDe while keeping validation logic |
| pinot-common/src/main/java/org/apache/pinot/common/metadata/ZKMetadataProvider.java | Switches to new SerDe APIs for table/logical-table configs |
| pinot-common/src/main/java/org/apache/pinot/common/config/provider/ZkTableCache.java | Switches to new SerDe APIs for table/logical-table configs |
| pinot-common/src/main/java/org/apache/pinot/common/config/provider/LogicalTableMetadataCache.java | Switches to new SerDe APIs for table/logical-table configs |
pinot-spi/src/main/java/org/apache/pinot/spi/data/LogicalTableConfig.java
Outdated
Show resolved
Hide resolved
pinot-spi/src/main/java/org/apache/pinot/spi/config/table/TableConfig.java
Outdated
Show resolved
Hide resolved
pinot-spi/src/main/java/org/apache/pinot/spi/data/LogicalTableConfig.java
Outdated
Show resolved
Hide resolved
pinot-spi/pom.xml
Outdated
| </dependency> | ||
| <dependency> | ||
| <groupId>org.apache.helix</groupId> | ||
| <artifactId>helix-core</artifactId> |
There was a problem hiding this comment.
Adding helix-core to pinot-spi makes Helix a transitive dependency for SPI consumers, which increases coupling and may be undesirable for a SPI layer. If keeping SPI lightweight is a goal, consider isolating ZNRecord SerDe into a separate module (e.g., a Helix-specific SPI extension) or exposing a Helix-agnostic representation (Map/JSON) from SPI while keeping ZNRecord conversions in pinot-common.
| <artifactId>helix-core</artifactId> | |
| <artifactId>helix-core</artifactId> | |
| <optional>true</optional> |
There was a problem hiding this comment.
IIRC we don't want to introduce Helix as a dependency to the SPI layer
cc - @Jackie-Jiang
There was a problem hiding this comment.
+1. And this is the main reason why we have a separate TableConfigSerDeUtils in pinot-common.
In order to override the ser/de behavior of them, you should make the ser/de component pluggable, but keep it within pinot-common to not pollute pinot-spi
There was a problem hiding this comment.
Thanks updated the PR.
I've added a config record object which is very similar to the data structure of ZNRecord. Technically it's coupled to ZNRecord, but there is no Helix dependency now. This is now a much simpler change than any alternative I could think of.
pinot-spi/src/main/java/org/apache/pinot/spi/data/LogicalTableConfig.java
Outdated
Show resolved
Hide resolved
|
TableRebalanceIntegrationTest test failures look to be intermittent failures as the test is passing locally and is unrelated to this change |
Move fromZNRecord/toZNRecord methods from TableConfigSerDeUtils and LogicalTableConfigUtils into the config classes themselves. This makes it easier to extend these classes — subclasses can override serialization/deserialization behavior directly. - Add helix-core dependency to pinot-spi for ZNRecord access - Add fromZNRecord()/toZNRecord() to TableConfig and LogicalTableConfig - Delete TableConfigSerDeUtils (all callers updated) - Remove fromZNRecord/toZNRecord from LogicalTableConfigUtils (validation stays) - Update all callers across 15 files to use the new methods directly - Add LogicalTableConfigSerDeTest for ZNRecord round-trip coverage Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pinot-spi/pom.xml
Outdated
| </dependency> | ||
| <dependency> | ||
| <groupId>org.apache.helix</groupId> | ||
| <artifactId>helix-core</artifactId> |
There was a problem hiding this comment.
+1. And this is the main reason why we have a separate TableConfigSerDeUtils in pinot-common.
In order to override the ser/de behavior of them, you should make the ser/de component pluggable, but keep it within pinot-common to not pollute pinot-spi
Replace ZNRecord-based SerDe on TableConfig and LogicalTableConfig with a helix-agnostic ConfigRecord POJO in pinot-spi. Bridge utilities in pinot-common (TableConfigSerDeUtils, LogicalTableConfigUtils) handle ZNRecord conversion, keeping helix-core out of the SPI layer. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The test failures are due to the docker environment issue. This is unrealted to this PR. |
Summary
Test plan
🤖 Generated with Claude Code