[ 
https://issues.apache.org/jira/browse/FLINK-41327?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ASF GitHub Bot updated FLINK-41327:
-----------------------------------
    Labels: pull-request-available  (was: )

> Binary IN/NOT IN predicates compare byte arrays by identity in SEARCH point 
> sets
> --------------------------------------------------------------------------------
>
>                 Key: FLINK-41327
>                 URL: https://issues.apache.org/jira/browse/FLINK-41327
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Runtime
>            Reporter: Luo Zhengjie
>            Priority: Major
>              Labels: pull-request-available
>
> The runtime ObjectHashSet used for SEARCH point sets delegates to HashSet. 
> SQL BINARY/VARBINARY values are represented as byte[], whose Java equality is 
> identity-based. A separately allocated value containing the same bytes as an 
> IN-list literal can therefore be reported as absent; NOT IN can produce the 
> opposite incorrect result.
> h3. Minimal runtime reproduction
> {code:java}
> ObjectHashSet<byte[]> set = new ObjectHashSet<>();
> set.add(new byte[] {1});
> boolean found = set.contains(new byte[] {1});
> // Expected: true. Actual: false.
> {code}
> Reproduced on community master ce373fe8b9e4131a0d756b739449e410318a74b5 
> (2.5-SNAPSHOT), using Java 17 and a source reactor build. New runtime 
> regression tests run: 3; failures: 2; errors: 0. The failures cover 
> equal-content membership and isolation from mutation of the inserted byte 
> array.
> CodeGeneratorContext.addReusableHashSet selects ObjectHashSet for binary 
> values. SQL coverage must use non-folded input and enough point literals to 
> exercise the SEARCH hash-set path rather than a short OR chain. SQL 
> integration validation is still in progress; no full-suite success is claimed.
> h3. Proposed fix
> Use content-based equality and hashing for byte-array keys, retain normal 
> equality for other key types, and copy inserted byte-array keys so later 
> caller mutation cannot invalidate membership. No dependency or storage-format 
> changes.
> Prepared with assistance from OpenAI Codex (GPT-5).



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to