From cda12829819d7e301268b4bdebb3ebbfc55b952f Mon Sep 17 00:00:00 2001 From: Stefan Brass <stefan.brass@informatik.uni-halle.de> Date: Fri, 4 Oct 2019 12:23:59 +0200 Subject: [PATCH] db/load_data now does the tsv->sql conversion --- db/conv_sql | 14 ++++++++++++-- db/load_data | 29 +++++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/db/conv_sql b/db/conv_sql index 62650f4..3f3e8b7 100755 --- a/db/conv_sql +++ b/db/conv_sql @@ -3,7 +3,7 @@ # Project: ddbench - Deductive System and Database Benchmarks # Filename: db/conv_sql # Purpose: AWK Script to Translate .tsv Benchmark Result to SQL -# Last Change: 02.02.2019 +# Last Change: 04.10.2019 # Language: Shellscript (bash) # Author: Stefan Brass # EMail: brass@informatik.uni-halle.de @@ -70,6 +70,11 @@ FNR == 1 { n = split(FILENAME, path_parts, "/"); arg = path_parts[n]; + dir = ""; + for(i = 1; i < n; i++) + dir = (dir path_parts[i] "/"); + #printf("Dir: '" dir "'\n"); + #---------------------------------------------------------------------- # Remove extension "tsv" (tab-separated-values) from input file: #---------------------------------------------------------------------- @@ -150,7 +155,12 @@ FNR == 1 { # Compute the output file name: #---------------------------------------------------------------------- - output = (filename[1] ".sql"); + # Old version without directory prefix: + #output = (filename[1] ".sql"); + + # New version with directory prefix: + output = (dir filename[1] ".sql"); + #printf("Output: '" output "'\n"); #---------------------------------------------------------------------- # Now we still have to check the column names in the first line: diff --git a/db/load_data b/db/load_data index 9310731..060d7e8 100755 --- a/db/load_data +++ b/db/load_data @@ -3,7 +3,7 @@ # Project: ddbench - Deductive System and Database Benchmarks # Filename: db/load_data # Purpose: Shellscript to create database and load all data -# Last Change: 19.03.2019 +# Last Change: 04.10.2019 # Language: Shellscript (bash) # Author: Stefan Brass # EMail: brass@informatik.uni-halle.de @@ -19,10 +19,17 @@ # Note that the tables and views of the database are dropped first # to start from a clean state. -# It is normal that this generates errors on the first execution. +echo "Dropping old versions of database tables and views." +echo "It is normal that there are error messages about missing objects" +echo "when the database is created for the first time." +echo psql -f drop_db.sql # Create Database Tables (Database Schema): +echo +echo "Creating tables and views of the database." +echo "It is normal that there are notices about implicitly created indexes." +echo psql -f create_db.sql | grep -v "INSERT 0 1" # Create Views: @@ -50,6 +57,9 @@ psql -f v_doc.sql # Print Table Data in Markdown Format (->Documentation) psql -f v_scripts.sql # Support for Benchmark Execution Scripts # Basic Data: +echo +echo "Loading basic data about machines, benchmarks, systems, and input files." +echo psql -f machines.sql | grep -v "INSERT 0 1" psql -f input_types.sql | grep -v "INSERT 0 1" psql -f benchmarks.sql | grep -v "INSERT 0 1" @@ -85,8 +95,23 @@ psql -f graph_types.sql | grep -v "INSERT 0 1" psql -f input_graphs.sql | grep -v "INSERT 0 1" psql -f input_join1.sql | grep -v "INSERT 0 1" +# Convert tsv-files with benchmark results to SQL: +# (might be unnecessary, if the SQL files already exist, but is safer, +# because SQL files might be missing or outdated) +echo +echo "Converting tsv-files with benchmark results to SQL INSERT statements." +echo +for FILE in results/*.tsv +do + ./conv_sql $FILE +done + +# Load SQL files with benchmark results: +echo +echo "Loading benchmark result data. This may take a while ..." for FILE in results/*.sql do psql -f $FILE | grep -v "INSERT 0 1" done +echo "Done." -- GitLab