-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Epic] Prepared Statement Support #4539
Comments
There are other things that I'm not sure whether they should be included in this effort or not is the Plan Cache support. |
Oracle Adaptive Cursor Sharing: |
That is an interesting idea -- in general I suggest that DataFusion include very basic support for prepared statements and allow for more advanced usecases such as adaptive replanning or partial plans, to systems that use DataFusion (e.g Ballista or IOx). This is similar to how The rationale for this separation is that the value of the various optimizations on shared cursors / replanning is likely specific for the particular usecase. For example, in IOx we don't plan to have any actual server side state for prepared statements and will basically replan the query on |
Update here is that most of the backend work is complete (see #7785). However the SQL support is not hooked up |
What's the best way to handle |
I tried this in datafusion CLI and it looks like
So you can probably use https://docs.rs/datafusion/latest/datafusion/dataframe/struct.DataFrame.html#method.with_param_values and use a ParamValues::Map (key name |
I tried ParamValues::Map, it needs key like |
I am not sure how MySQL works. Is |
This sounds like a good solution. Thanks. |
@alamb is this Epic ok to be closed ? |
Good call -- thanks @comphead |
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
Prepared Statements are widely used by SQL clients when issuing queries to a database. Major use cases include improved transaction processing latency as well as preventing SQL injection attacks (parameterized query arguments are often implemented as a feature of prepared statements).
Supporting prepared statements will increase the number of client applications that can work with DataFusion.
Task List
PREPARE
forSELECT
)EXECUTE
for prepared statements feat: basic support for executing prepared statements #13242$1
in more types of queries. #13632Background
Here is a schematic of how prepared statements work:
Steps:
Some protocols (like the postgres FrontEnd - BackEnd , FEBE, protocol) allow optionally sending both messages in the same transmission to avoid a network round trip.
Describe the solution you'd like
We would like:
PREPARE
statements.EXECUTE
statements PreparedStatements with bind parameters.Both PREPARE and EXECUTE should offer a basic implementation in SessionContext and the ability to extend by other systems (similar to CREATE VIEW and CREATE TABLE)
cc @NGA-TRAN
The text was updated successfully, but these errors were encountered: