/
GraphTreeHeap
/
museumdb2_experiments
Обзор
Документация
Войти
/
GraphTreeHeap
/
museumdb2_experiments
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
scripts/result_aggregator.py
45 строк
2 KB
FedMam
Add all scripts
25 май 2026, 19:18
25 май 2026, 19:18
a73447a
Код
Авторство
О чём код?
import sys import csv import re table_name = sys.argv[1] with open(f'{table_name}-queries.tsv', 'r') as museum_file, \ open(f'{table_name}-queries.sql.output', 'r') as postgres_file, \ open(f'{table_name}-queries.my.sql.output', 'r') as mysql_file, \ open(f'{table_name}-final.csv', 'w') as output_file: writer = csv.writer(output_file) writer.writerow(['Type', 'MuseumDB2_Time', 'PostgreSQL_Time', 'MySQL_Time', 'PostgreSQL_PlanningTime', 'PostgreSQL_ExecutionTime']) for museum_row in museum_file: query_args = museum_row.strip().split('\t') tp = query_args[0] if tp == 'range': tp += f'({query_args[-1]})' museum_time = query_args[1] while True: postgres_line = postgres_file.readline() if not postgres_line.startswith(' Planning'): continue planning_time = float(re.match(r' Planning Time: (\d*\.\d*) ms\s*', postgres_line).group(1)) / 1000 while not postgres_line.startswith(' Execution'): postgres_line = postgres_file.readline() execution_time = float(re.match(r' Execution Time: (\d*\.\d*) ms\s*', postgres_line).group(1)) / 1000 postgres_time = planning_time + execution_time break while True: mysql_line = mysql_file.readline() if not mysql_line[0].isdigit(): continue mysql_time = mysql_line.split('\t')[1] break writer.writerow([tp, museum_time, '%.9f' % (postgres_time,), mysql_time, '%.9f' % (planning_time,), '%.9f' % (execution_time,)])