Skip to content

Commit

Permalink
Optimize the calling of data provider if table is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
AmrDeveloper committed Aug 5, 2024
1 parent 49a1b15 commit f2da35a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion crates/gitql-engine/src/engine_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,13 @@ fn execute_select_statement(
table_titles.push(get_column_name(alias_table, selected_column));
}

let selected_rows = data_provider.provide(table_name, selected_columns)?;
// Call the provider only if table name is not empty
let selected_rows: Vec<Row> = if table_name.is_empty() {
vec![Row { values: vec![] }]
} else {
data_provider.provide(table_name, selected_columns)?
};

selected_rows_per_table.insert(table_name.to_string(), selected_rows);

// Append hidden selection in the right position
Expand Down

0 comments on commit f2da35a

Please sign in to comment.