Tushar7012 opened a new pull request, #20248:
URL: https://github.com/apache/datafusion/pull/20248

   ## What does this PR do?
   
   This PR adds a new SQLLogicTest file, `subquery_additional.slt`, to expand 
test coverage for subquery evaluation in DataFusion.
   
   The existing `subquery.slt` file is primarily focused on EXPLAIN plan 
verification (decorrelation and physical plan shapes). While that coverage is 
valuable, it provides limited direct validation of result correctness for many 
common scalar and correlated subquery patterns. This PR complements the 
existing tests by exercising subquery execution behavior directly.
   
   ---
   
   ## Which issue does this PR close?
   
   Closes #20240
   
   ---
   
   ## What changes are included?
   
   - Adds `subquery_additional.slt` with ~59 test cases across 22 subquery 
categories
   - Test cases are adapted from DuckDB’s scalar subquery test suite and 
conservatively adjusted to align with DataFusion semantics
   
   Covered patterns include:
   
   - Basic and nested scalar subqueries (uncorrelated)
   - Correlated scalar subqueries with aggregates
   - Nested correlated subqueries (2–4 levels deep)
   - `EXISTS` / `NOT EXISTS`, `IN` / `NOT IN` (correlated and uncorrelated)
   - Subqueries with `DISTINCT`, `COALESCE`, `CASE WHEN`, and CTEs
   - Subqueries in `HAVING`, `BETWEEN`, and general expression contexts
   - `UNION` / `UNION ALL` inside subqueries
   - NULL-handling edge cases
   - Subqueries inside window function contexts
   - Multiple scalar subqueries in `SELECT`
   
   ---
   
   ## DataFusion-specific adjustments
   
   Expected outputs were aligned with DataFusion behavior where it 
intentionally differs from DuckDB, including:
   
   - NULL sort ordering (`nulls_max` default — NULLs sort last in ASC)
   - Type code mappings (e.g. `Int64`, `Float64`)
   - Derived table aliasing requiring exact column count matches
   
   No engine, planner, optimizer, or execution code has been modified. This PR 
is strictly a test coverage addition.
   
   ---
   
   ## Are these changes tested?
   
   This PR is the test. It can be run with:
   
   ```bash
   cargo test --package datafusion-sqllogictest --test sqllogictests -- 
subquery_additional
   


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