Andrew Kyle Purtell created PHOENIX-8072:
--------------------------------------------
Summary: Do not relocate or bundle org.bson in the shaded client
jars
Key: PHOENIX-8072
URL: https://issues.apache.org/jira/browse/PHOENIX-8072
Project: Phoenix
Issue Type: Bug
Components: core
Reporter: Andrew Kyle Purtell
Assignee: Andrew Kyle Purtell
Fix For: 5.4.0, 5.3.3
BSON columns expose {{org.bson}} types directly through the JDBC API, whereas
{{phoenix-client-embedded}} and {{phoenix-client-lite}} relocate the
{{org.bson}} package into the shaded Phoenix namespace. This package relocation
breaks class identity across the JDBC boundary, preventing applications from
binding or reading BSON documents as typed objects. To preserve type
compatibility between application code and the JDBC driver, {{org.bson}} must
remain unrelocated and unbundled in the shaded client artifacts, following the
same packaging model established for {{io.opentelemetry}} in the PHOENIX-5215
addendum.
Because the embedded and lite client builds apply a broad {{org/}} shade
relocation to {{org.apache.phoenix.shaded.org}}, the driver's internal type
checks and return values reference the shaded classes rather than the
{{org.bson}} classes loaded by the application. Passing an application
{{BsonDocument}} to {{setObject}} fails type validation, and documents returned
by {{getObject}} cannot be cast to {{org.bson.BsonDocument}}.
{noformat}
java.lang.UnsupportedOperationException: Unsupported literal value [{"s": "x"}]
of type org.bson.BsonDocument
{noformat}
{noformat}
java.lang.IllegalArgumentException: The object should be of type BsonDocument
{noformat}
Applications using the shaded clients will be restricted to interacting with
BSON columns via serialized JSON strings through {{setString}} and
{{getString}}.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)