Skip to content

Commit

Permalink
cast untyped start and step when inferring type for
Browse files Browse the repository at this point in the history
`generate_series`
  • Loading branch information
stdrc committed Oct 2, 2024
1 parent ef8c50f commit 50f30f5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/frontend/src/expr/type_inference/func.rs
Original file line number Diff line number Diff line change
Expand Up @@ -704,10 +704,18 @@ fn infer_type_for_special_table_function(
) -> Result<Option<DataType>> {
match func_type {
PbTableFuncType::GenerateSeries => {
if inputs.len() < 3 {
if inputs.len() < 3 || !inputs[1].is_now() {
// let signature map handle this
return Ok(None);
}
// Now we are inferring type for `generate_series(start, now(), step)`, which will
// be further handled by `GenerateSeriesWithNowRule`.
if inputs[0].is_untyped() {
inputs[0].cast_implicit_mut(DataType::Timestamptz)?;
}
if inputs[2].is_untyped() {
inputs[2].cast_implicit_mut(DataType::Interval)?;
}
match (
inputs[0].return_type(),
inputs[1].return_type(),
Expand Down

0 comments on commit 50f30f5

Please sign in to comment.