Skip to content

Logical plan placeholders can't contain metadata #17862

@paleolimbot

Description

@paleolimbot

Is your feature request related to a problem or challenge?

The logical expr Placeholder is currently defined in terms of DataType:

/// Placeholder, representing bind parameter values such as `$1` or `$name`.
///
/// The type of these parameters is inferred using [`Expr::infer_placeholder_types`]
/// or can be specified directly using `PREPARE` statements.
#[derive(Clone, PartialEq, Eq, PartialOrd, Hash, Debug)]
pub struct Placeholder {
/// The identifier of the parameter, including the leading `$` (e.g, `"$1"` or `"$foo"`)
pub id: String,
/// The type the parameter will be filled in with
pub data_type: Option<DataType>,
}

We're hoping to use this to implement parameterized queries in SedonaDB and we'd love to be able to attach field metadata to this (either like Literal with extra metadata, or like scalar functions where we use a FieldRef).

It may be that these placeholder types are inferred correctly (I haven't checked).

Describe the solution you'd like

Either adding field metadata or expressing the data type as a field ref would allow literals with an extension type to be plugged in here.

Describe alternatives you've considered

We can produce non-parameterized SQL strings to function calls that produce an extension type.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions