Repository navigation
[Server] Pass a typed properties setter to RepositoryUtils.attachProperties - #2326
Merged
yili-db merged 1 commit intoNov 20, 2026
Conversation
…erties attachProperties found setProperties(Map) by reflection, so a model whose properties are not a Map, such as FunctionInfo, compiled and then failed at runtime once property rows existed (the bug fixed in unitycatalog#2319). Callers now pass the setter as a method reference, so an incompatible model fails to compile. The property lookup and the skip when there are no rows are unchanged. Add a RepositoriesTest case that checks catalog, schema and table get, list and update responses carry each entity's stored properties. Signed-off-by: Maha Rana Yadavalli <[email protected]>
maharanay22
requested review from
openinx,
tdas,
timothyw553 and
yili-db
as code owners
November 20, 2026 18:45
3 of 4 tasks
Collaborator
|
/review |
yili-db
approved these changes
Nov 20, 2026
yili-db
left a comment
Collaborator
There was a problem hiding this comment.
[AI Assisted] Approving at b8dc699.
- This is a refactor. The property lookup, the leave-unchanged-when-empty rule, and the returned instance are the same as before. The only observable change is that
SchemaRepository.getSchemaruns one fewer properties query; the output is unchanged. - All eight remaining call sites pass a typed setter, and no caller was missed. The function path no longer goes through this helper, so the #2319 failure cannot return through it.
- Verified: the touched tests pass (48 of 48). A call that passes
FunctionInfo::setPropertiesfails to compile, as the description says.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
docsis updatedDescription of changes
This follows up on #2319, as suggested in its review.
RepositoryUtils.attachPropertieslooked upsetProperties(Map)on the model by reflection, so a model whose properties aren't a map compiled fine and then failed at runtime, and only once the entity had property rows. That is how a function transfer failed withNoSuchMethodExceptionbefore #2319, becauseFunctionInfo.propertiesis a JSON string.Callers now pass the setter as a method reference, for example
CatalogInfo::setProperties, typed asBiConsumer<T, Map<String, String>>. PassingFunctionInfo::setPropertiesno longer compiles, so that mistake shows up at build time. The reflection and its exception wrapping are removed. The property lookup is unchanged, and the model is still left untouched when there are no property rows, so API responses don't change.SchemaRepository.getSchemaattached the properties a second time afterconvertFromDAOhad already done it, so that redundant call is removed.Tests
RepositoriesTest.catalogSchemaAndTableReadsAttachTheirPropertiesstores a catalog, a schema and a table with different properties, and checks that get, list and update for catalogs and schemas, and get and owner update for tables, return each entity's own properties. Replacing the setter with a no-op at any call site makes it fail. A scratch call passingFunctionInfo::setPropertiesfailedserver/compilewith "incompatible types: invalid method reference".build/sbt "server/testOnly io.unitycatalog.server.persist.RepositoriesTest io.unitycatalog.server.persist.OwnershipRepositoryTest io.unitycatalog.server.persist.utils.RepositoryUtilsTest"passes on H2 on Windows with JDK 17, and so doserver/javafmtCheckAlland checkstyle. The change has no SQL, so MySQL and PostgreSQL run in CI.