Skip to content

Conversation

@jonahgao
Copy link
Member

Which issue does this PR close?

Part of #4539

Rationale for this change

In order to support EXECUTE for prepared statements, we should first support creating logical plans for EXECUTE statements.

The syntax is same to PostgreSQL.

psql=> prepare p(int) as select $1;
PREPARE
psql=> execute p(10);
 ?column?
----------
       10
(1 row)

What changes are included in this PR?

Add a new LogicalPlan

pub struct Execute {
    /// The name of the prepared statement to execute
    pub name: String,
    /// The execute parameters
    pub parameters: Vec<Expr>,
    /// Dummy schema
    pub schema: DFSchemaRef,
}

Are these changes tested?

Yes

Are there any user-facing changes?

Yes

@github-actions github-actions bot added sql SQL Planner logical-expr Logical plan and expressions optimizer Optimizer rules core Core DataFusion crate sqllogictest SQL Logic Tests (.slt) proto Related to proto crate labels Oct 31, 2024
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really nice to me -- thank you @jonahgao

@jonahgao jonahgao merged commit d2a15b3 into apache:main Nov 1, 2024
@jonahgao
Copy link
Member Author

jonahgao commented Nov 1, 2024

Thanks for the review @alamb

@jonahgao jonahgao deleted the execute_plan branch November 1, 2024 02:51
@alamb alamb mentioned this pull request Nov 5, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core DataFusion crate logical-expr Logical plan and expressions optimizer Optimizer rules proto Related to proto crate sql SQL Planner sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants