diff --git a/premsql/executors/base.py b/premsql/executors/base.py index 2321027..9e91131 100644 --- a/premsql/executors/base.py +++ b/premsql/executors/base.py @@ -46,10 +46,13 @@ def iterated_execution( if is_match["result"] == 1: diff_list = [ + # Bug fix: denominator must use predicted_sql, not gold_sql. + # The original code divided gold_time / gold_time (always 1.0), + # making VES meaningless. Correct formula: gold_time / predicted_time. self.execute_sql(sql=gold_sql, dsn_or_db_path=dsn_or_db_path)[ "execution_time" ] - / self.execute_sql(sql=gold_sql, dsn_or_db_path=dsn_or_db_path)[ + / self.execute_sql(sql=predicted_sql, dsn_or_db_path=dsn_or_db_path)[ "execution_time" ] for _ in range(num_iterations)