Repository navigation
Additionally support Postgis Geography codec under one generic PostgisCodec - #727
mdedetrich wants to merge 2 commits into
Conversation
3ec52e3 to
64f447d
Compare
8d0e343 to
548ad38
Compare
|
After realizing an issue with this implementation, specifically that encoding an object using Given that, I opted for a design that is more semantically correct, i.e. treat This did require touching some other internals i.e. |
f03ef79 to
8493054
Compare
|
@mp911de When do you have capacity to review this PR? I am asking because there are follow up pull requests based on this one that I want to look at. |
|
This is an interesting addition, but the changes touch several places, apparently to avoid registering two codec instances. Honoring the method-provided OID for encoding is a useful improvement on its own right. However, discovery and type translation now have two owners, making the built-in registration mechanism harder to follow.
A few details could also be simplified: The explanatory comments are rather lengthy for the behavior involved with causing noise only. Such changes lead to overall code quality deterioration as comments vs. behavior diverges over time. Tests calling We appreciate community contributions, but we do need them to meet a reasonable baseline for consideration. If LLM-generated code still requires substantial simplification, submitting it largely shifts that work to the maintainers resulting in negative value contributions. There's little difference in maintainers prompting an LLM and then cleaning up AI-generated code bloat vs. someone else prompting an LLM and then maintainers cleaning up AI-generated code bloat. |
|
Thanks for the response!
Would like to apologize for creating unnecessary burden, this definitely was not the intention. It is true that I am using LLM (specifically claude), the comments on this PR was already pruned before submitting but clearly its still too verbose (in general this is one big issue with Claude, it tends to create eulogy like code comments and this need to be explicitly cleaned multiple times). Would you be open to me contributing an
This was actually the original solution and then I changed the implementation to use this one thinking it would be a better design, I was using the java I have just done what you instructed and also rebased off of main. Let me know if anything else is needed |
Revert the intermediate discovery step (DiscoveredType, collectList(), registerCodecs()) and register PostgisGeometryCodec once for each OID. The geography instance is decode-only, so geometry stays the default encoding type whatever order pg_type returns the rows in. Use the OID passed to encode(Object, int), make GeometryFactory static, and trim the verbose comments and the tests that bypassed discovery.
98b756f to
9326eba
Compare
Make sure that:
Issue description
Resolves: #528
New Public APIs
PostgisGeographyCodec(if this counts as an API).Additional context
Note that the implementation does have a fair bit of boilerplate due to
PostgisGeographyCodecbeing final and hence not being able to be subclassed. One alternative would be to have a package private implementation that bothPostgisGeographyCodecandPostgisGeometryCodeccan share (that way bothPostgisGeographyCodecandPostgisGeometryCodeccan be final).As suggested in the linked github issue, the implementation is just a copy paste of
PostgisGeometryCodecthat also uses theorg.locationtech.jts.geom.Geometrybut this allows you to decode postgresgeographytypes.