Skip to content

Conversation

@srielau
Copy link
Contributor

@srielau srielau commented Dec 30, 2025

What changes were proposed in this pull request?

SELECT INTO Spec

Support the single row SELECT INTO statement in SQL Scripting.
SELECT INTO retrieves a single rows and inserts it into a list of local or session variables.
If more than one row is found an error is raised. If no row is found NO DATA is raised (which by default is a NOOP), and no variables are updated.

Example:

BEGIN
  DECLARE shortest STRING;
  SELECT first || ‘ ‘ || last 
    INTO shortest
    FROM VALUES('Bilbo', 'Baggins'), ('Peregrin', 'Tuck')
             AS hobbits(first, last)
    ORDER BY LENGTH(first || ‘ ‘ || last) LIMIT 1;
  VALUES (shortest);
END;

Why are the changes needed?

SELECT INTO is a common SQL Standard command. Supporting it completes teh SQL Scripting stpry and facilitates migration to Spark.

Does this PR introduce any user-facing change?

SELECT INTO Spec

How was this patch tested?

A new test suite was writen.

Was this patch authored or co-authored using generative AI tooling?

Claude

@github-actions github-actions bot added the SQL label Dec 30, 2025
@srielau srielau marked this pull request as draft December 30, 2025 02:45
@srielau srielau changed the title SELECT INTO [WIP] SELECT INTO Dec 30, 2025
@github-actions
Copy link

github-actions bot commented Jan 1, 2026

JIRA Issue Information

=== New Feature SPARK-54880 ===
Summary: SELECT INTO statement
Assignee: None
Status: Open
Affected: ["4.2.0"]


This comment was automatically generated by GitHub Actions

@srielau srielau changed the title [WIP] SELECT INTO [SPARK-54880] [SQL] SELECT INTO Jan 1, 2026
@srielau srielau changed the title [SPARK-54880] [SQL] SELECT INTO [SPARK-54880] [SQL] SELECT INTO statement support Jan 1, 2026
@srielau srielau marked this pull request as ready for review January 1, 2026 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant