-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
When using a parameterized query with a placeholder indicating the value in the LIMIT clause, the datatype is not inferred.
To Reproduce
let schema = Arc::new(Schema::new(vec![Field::new("A", DataType::Int32, true)]));
let source = Arc::new(LogicalTableSource::new(schema.clone()));
let placeholder_value = "$1";
// SELECT * FROM my_table LIMIT $1
let plan = LogicalPlan::Limit(Limit {
skip: None,
fetch: Some(Box::new(Expr::Placeholder(Placeholder {
id: placeholder_value.to_string(),
data_type: None,
}))),
input: Arc::new(LogicalPlan::TableScan(TableScan {
table_name: TableReference::from("my_table"),
source,
projected_schema: Arc::new(DFSchema::try_from(schema.clone())?),
projection: None,
filters: vec![],
fetch: None,
})),
});
let params = plan.get_parameter_types().expect("to infer type");
assert_eq!(params.len(), 1);
let parameter_type = params
.clone()
.get(placeholder_value)
.expect("to get type")
.clone();
assert_eq!(parameter_type, Some(DataType::Int64));assertion `left == right` failed
left: None
right: Some(Int64)Expected behavior
Assertion passes.
Additional context
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working