Skip to content
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

fix: vector function for PromQL need to ignore the time index also #5398

Merged
merged 6 commits into from
Jan 22, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: do not affect scalar function
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
yihong0618 committed Jan 19, 2025
commit dd1121ba6837fbe62caabd7a85ceba7c8d63ec65
10 changes: 8 additions & 2 deletions src/query/src/promql/planner.rs
Original file line number Diff line number Diff line change
@@ -409,6 +409,10 @@ impl PromPlanner {
}
}
let mut field_columns = left_field_columns.iter().zip(right_field_columns.iter());
let is_vector_matching = (left_field_columns.len() == 1
&& left_field_columns[0] == GREPTIME_VALUE)
|| (right_field_columns.len() == 1 && right_field_columns[0] == GREPTIME_VALUE);

let join_plan = self.join_on_non_field_columns(
left_input,
right_input,
@@ -417,6 +421,7 @@ impl PromPlanner {
// if left plan or right plan tag is empty, means case like `scalar(...) + host` or `host + scalar(...)`
// under this case we only join on time index
left_context.tag_columns.is_empty() || right_context.tag_columns.is_empty(),
is_vector_matching,
)?;
let join_plan_schema = join_plan.schema().clone();

@@ -2003,6 +2008,7 @@ impl PromPlanner {
left_table_ref: TableReference,
right_table_ref: TableReference,
only_join_time_index: bool,
is_vector_matching: bool,
) -> Result<LogicalPlan> {
let mut tag_columns = if only_join_time_index {
vec![]
@@ -2016,8 +2022,8 @@ impl PromPlanner {

// push time index column if it exists
if let Some(time_index_column) = &self.ctx.time_index_column {
// issue #5392 if only_join_time_index is true, we don't need to push time_index_column to tag_columns
if !only_join_time_index {
// issue #5392 if is special vector function
if !is_vector_matching {
tag_columns.push(Column::from_name(time_index_column));
}
}