97nitt opened a new pull request, #2328:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2328

   ## Summary
   
   Snowflake `COPY INTO ... FROM (SELECT ...)` transformation lists support cast
   expressions like `$1:"col"::TYPE` and `$1::TYPE`, e.g.:
   
   ```sql
   COPY INTO my_company.emp_basic (a)
   FROM (SELECT $1:"A"::NUMBER(38, 0) FROM @stg);
   ```
   
   Today the Snowflake-specific stage-load-select-item parser successfully
   consumes `$1:"A"` as a stage-load-select-item, leaves `::NUMBER(38, 0)` in
   the token stream, and the surrounding `COPY INTO` body then fails with
   `Expected: FROM, found: ::`.
   
   ## Changes
   
   - `parse_select_item_for_data_load`: bail (so `maybe_parse` rewinds and the
     caller falls through to the generic `parse_select_item`) when the next
     token is `::`. The generic path already handles cast operators on `$<n>`
     references correctly.
   - Tests: regression cases for `$1:"col"::TYPE`, `$1::TYPE`,
     `$1:SEQUENCE::TYPE`, multi-column lists, and a mixed list combining a
     plain stage-load-select-item with a cast item — verifying we don't
     over-correct and break the existing shape.
   
   ## Test plan
   
   - [x] `cargo test`
   - [x] `cargo fmt --check`
   - [x] `cargo clippy --all-targets --all-features -- -D warnings`


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