MCPcopy Create free account
hub / github.com/FlyingFeather/DEA-SQL / iterated_execute_sql

Function iterated_execute_sql

evaluation/src/evaluation_ves.py:40–56  ·  view source on GitHub ↗
(predicted_sql, ground_truth, db_path, iterate_num)

Source from the content-addressed store, hash-verified

38
39
40def iterated_execute_sql(predicted_sql, ground_truth, db_path, iterate_num):
41 conn = sqlite3.connect(db_path)
42 diff_list = []
43 cursor = conn.cursor()
44 cursor.execute(predicted_sql)
45 predicted_res = cursor.fetchall()
46 cursor.execute(ground_truth)
47 ground_truth_res = cursor.fetchall()
48 time_ratio = 0
49 if set(predicted_res) == set(ground_truth_res):
50 for i in range(iterate_num):
51 predicted_time = execute_sql(predicted_sql, db_path)
52 ground_truth_time = execute_sql(ground_truth, db_path)
53 diff_list.append(ground_truth_time / predicted_time)
54 processed_diff_list = clean_abnormal(diff_list)
55 time_ratio = sum(processed_diff_list) / len(processed_diff_list)
56 return time_ratio
57
58
59def execute_model(predicted_sql, ground_truth, db_place, idx, iterate_num, meta_time_out):

Callers

nothing calls this directly

Calls 3

clean_abnormalFunction · 0.85
execute_sqlFunction · 0.70
executeMethod · 0.45

Tested by

no test coverage detected