github-actions[bot] commented on code in PR #64080:
URL: https://github.com/apache/doris/pull/64080#discussion_r3374932976


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/types/JsonType.java:
##########
@@ -34,6 +35,11 @@ public class JsonType extends PrimitiveType {
     private JsonType() {
     }
 
+    @Override
+    public boolean isInjectiveCastTo(DataType target) {

Review Comment:
   `JSONB -> STRING/VARCHAR/CHAR` is not injective, so this branch can still 
make `PushProjectThroughUnion` change `UNION DISTINCT` results. In BE, 
`DataTypeStringSerDeBase::deserialize_column_from_jsonb_vector` casts JSONB 
strings by inserting the raw string payload, but non-string JSONB values 
through `JsonbToJson`; therefore JSONB string `"1"` and JSONB number `1` are 
distinct JSONB values before the cast but both become the same string `1`. With 
this predicate, `select cast(j as string) from (select cast('\"1\"' as jsonb) j 
union select cast('1' as jsonb) j) t` can have duplicate elimination moved 
after the cast and collapse one row. Please keep JSONB-to-character unsafe 
unless the cast output is proven to preserve JSONB type identity.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to