xgbtxy opened a new pull request, #5361:
URL: https://github.com/apache/calcite/pull/5361

   ## Jira Link
   
   [CALCITE-7880](https://issues.apache.org/jira/browse/CALCITE-7880)
   
   ## Changes Proposed
   
   ```sql
   SELECT k + 1 AS x
   FROM (VALUES (CAST(2147483647 AS INTEGER))) AS d(k)
   JOIN (VALUES (CAST(2147483647 AS BIGINT))) AS f(k) USING (k)
   ```
   
   When an INTEGER key joins a BIGINT key with USING, the unqualified common 
column can retain the selected input's narrower type. For example, adding 1 to 
the common key 2147483647 returns -2147483648, while SELECT * exposes the key 
as BIGINT.
   
   Cast the selected common-column reference to the comparison common type, 
using the same type-selection rule as star expansion. INNER/LEFT still select 
the left input and RIGHT still selects the right input, retaining 
CALCITE-2659's removal of redundant COALESCE. FULL JOIN and explicitly 
qualified input references retain their existing handling. The change preserves 
the selected expression's existing nullability.
   
   The regression tests execute INTEGER/BIGINT inputs in both orders across 
INNER, LEFT, RIGHT, FULL and NATURAL joins, assert JDBC result types and 
qualified-column controls, and check nullable/unmatched rows for LEFT/RIGHT 
joins. Validator coverage includes direct common-column references with 
identifier expansion disabled and arithmetic with expansion enabled.
   
   Validation on Windows with JDK 17 for tests and the project-default JDK 25 
compilation toolchain:
   
   - `gradlew.bat --no-daemon --no-parallel --max-workers=4 build` passed, 
including formatting, Checkstyle, bytecode/API checks and the default test 
suites. JUnit XML reports 22,263 passed, zero failures/errors and 751 skipped 
entries; extra external-integration and slow-test profiles were not enabled.
   - The focused run passed 24 tests (19 new cases plus 5 existing tests). On 
unmodified main, the new 19-case matrix had 9 failures and 10 passing controls.
   
   AI assistance: implementation, test development and local validation used 
OpenAI Codex.
   


-- 
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]

Reply via email to