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

   ## Which issue does this PR close?
   
   Partially addresses #25449; this does not close it. This is a narrower 
follow-up to closed #26769, focused on aliases that do not match the generated 
name format. The typed-marker design remains open.
   
   ## Rationale for this change
   
   A user alias such as `__datafusion_extracted_manual` can make the optimizer 
move an ordinary expression below a filter. For example, this query fails with 
division by zero even though the filter excludes zero:
   
   ```sql
   CREATE TABLE t AS SELECT * FROM (VALUES (0), (1)) AS v(id);
   SELECT 10 / id AS __datafusion_extracted_manual FROM t WHERE id > 0;
   ```
   
   With this change it returns `10`.
   
   ## What changes are included in this PR?
   
   Recognize extraction aliases only when the prefix is followed by an 
underscore and an ASCII numeric suffix that fits the alias counter. Share that 
check between extraction recognition and counter seeding. Update the existing 
extraction fixture to use a numeric name.
   
   ## What is the testing strategy for this PR?
   
   The new cases in `projection_pushdown.slt` cover the bare prefix and the 
suffixes `_manual`, `_1x`, and `_+1`. All reproduce division by zero without 
the fix and return the expected result with it. Existing plan expectations are 
unchanged.
   
   The leaf-extraction tests, `projection_pushdown.slt`, workspace extended 
test suite, and Clippy with all targets and features passed.
   
   ## Are there any user-facing changes?
   
   Aliases that merely share the extraction prefix no longer cause ordinary 
expressions to be treated as internal extractions. Public Rust APIs and 
protobuf formats are unchanged.
   
   Fully numeric names such as `__datafusion_extracted_1` remain reserved and 
ambiguous. Resolving that ambiguity requires the separate marker design 
discussed in #25449.
   
   This draft was prepared with AI assistance.
   


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