zhangshenghang opened a new pull request, #12528:
URL: https://github.com/apache/seatunnel/pull/12528

   ### Purpose of this pull request
   
   Close #12523.
   
   `ZetaSQLEngine#project` evaluates every select item through the general 
expression evaluator for every row. For the very common projection-only 
statement `SELECT source_col AS target_col, ... FROM ...`, the statement is 
just a field reordering/renaming that can be resolved to fixed input field 
indexes once at parse time.
   
   This PR adds a fast path:
   
   - At parse time, if every select item is a plain column reference (no 
where/having/distinct, no functions/literals/wildcards), the input field 
indexes are precomputed (backtick-quoted names are handled).
   - `project` then copies the fields by index instead of evaluating the 
expression tree per row.
   - Anything else keeps the original evaluator, so behavior is unchanged for 
all other statements.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. Results are identical; only the evaluation strategy for plain column 
projections changes.
   
   ### How was this patch tested?
   
   - Added `ZetaSQLEngineTest#testDirectColumnProjection` (aliases) and 
`#testDirectColumnProjectionReordersAndQuotesColumns` (reordering plus 
backtick-quoted column). Existing tests with expressions/filters 
(`testTypeMappingAndTransformBySQL`, `testWhereFilterDropsRow`) cover the 
fallback path.
   - `mvn -pl seatunnel-transforms-v2 test`: 1160 tests, all passing.


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