r1b commented on code in PR #18450:
URL: https://github.com/apache/datafusion/pull/18450#discussion_r2484980004


##########
datafusion/sql/src/expr/value.rs:
##########
@@ -123,8 +123,19 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
                 return if param_data_types.is_empty() {
                     Ok(Expr::Placeholder(Placeholder::new_with_field(param, 
None)))
                 } else {
-                    // when PREPARE Statement, param_data_types length is 
always 0
-                    plan_err!("Invalid placeholder, not a number: {param}")
+                    // FIXME: This branch is shared by params from PREPARE and 
CREATE FUNCTION, but
+                    // only CREATE FUNCTION currently supports named params. 
For now, we rewrite
+                    // these to positional params.

Review Comment:
   **note** I explored doing this without rewriting to positional params, but I 
couldn't see a path forward without either:
   
   - Adding a way to distinguish between prepared statement vs SQL UDF context
   - Supporting named params in prepared statements (not currently supported in 
sqlparser AFAICT)



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