From 2638888b416b7a98bd5de681e72c8d569b71f3d5 Mon Sep 17 00:00:00 2001 From: Brewknight Date: Mon, 14 Jan 2019 21:27:29 +0200 Subject: [PATCH] Fixed mem leaks and commented out a problematic assert, since two relations may share the same name --- Makefile | 85 ---------------------------------------------- src/statistics.cpp | 10 +++--- workload/input.txt | 6 ---- 3 files changed, 5 insertions(+), 96 deletions(-) delete mode 100644 Makefile delete mode 100644 workload/input.txt diff --git a/Makefile b/Makefile deleted file mode 100644 index c58a6d7..0000000 --- a/Makefile +++ /dev/null @@ -1,85 +0,0 @@ - -CC = g++ -CCFLAGS = -Wall -Wextra -std=c++17 -g3 - -LIBS = -lpthread - -PATH_SRC = ./src -PATH_INC = ./inc -PATH_BIN = ./bin -PATH_TEST = ./test - -.PHONY: all -all: - mkdir -p $(PATH_BIN) - @echo - @echo "*** Compiling object files ***" - @echo "***" - make $(OBJS) - @echo "***" - -.PHONY: clean -clean: - @echo - @echo "*** Purging binaries ***" - @echo "***" - rm -rvf $(PATH_BIN) - @echo "***" - - -EXECUTIONER_DEP = $(addprefix $(PATH_INC)/, statistics.hpp join_enumerator.hpp executioner.hpp types.hpp result.hpp relation.hpp list.hpp meta.hpp query.hpp pair.hpp pair.ipp list.ipp) $(PATH_SRC)/executioner.cpp - -HISTHASH_DEP = $(addprefix $(PATH_INC)/, types.hpp histhash.hpp result.hpp relation.hpp list.hpp list.ipp) $(PATH_SRC)/histhash.cpp - -INDEX_DEP = $(addprefix $(PATH_INC)/, types.hpp histhash.hpp result.hpp relation.hpp list.hpp index.hpp list.ipp) $(PATH_SRC)/index.cpp - -JOIN_ENUMERATOR_DEP = $(addprefix $(PATH_INC)/, statistics.hpp join_enumerator.hpp executioner.hpp types.hpp result.hpp relation.hpp list.hpp query.hpp pair.hpp pair.ipp list.ipp) $(PATH_SRC)/join_enumerator.cpp - -META_DEP = $(addprefix $(PATH_INC)/, statistics.hpp types.hpp list.hpp meta.hpp query.hpp list.ipp) $(PATH_SRC)/meta.cpp - -QUERY_DEP = $(addprefix $(PATH_INC)/, types.hpp query.hpp) $(PATH_SRC)/query.cpp - -RELATION_DEP = $(addprefix $(PATH_INC)/, types.hpp histhash.hpp result.hpp relation.hpp list.hpp index.hpp list.ipp) $(PATH_SRC)/relation.cpp - -RESULT_DEP = $(addprefix $(PATH_INC)/, types.hpp result.hpp relation.hpp list.hpp list.ipp) $(PATH_SRC)/result.cpp - -STATISTICS_DEP = $(addprefix $(PATH_INC)/, statistics.hpp types.hpp meta.hpp query.hpp) $(PATH_SRC)/statistics.cpp - -THREAD_POOL_DEP = $(addprefix $(PATH_INC)/, list.hpp thread_pool.hpp list.ipp) $(PATH_SRC)/thread_pool.cpp - - -$(PATH_BIN)/executioner.o: $(EXECUTIONER_DEP) - $(CC) -I $(PATH_INC) $(DEFINED) $(CCFLAGS) $(PATH_SRC)/executioner.cpp -c -o $(PATH_BIN)/executioner.o - -$(PATH_BIN)/histhash.o: $(HISTHASH_DEP) - $(CC) -I $(PATH_INC) $(DEFINED) $(CCFLAGS) $(PATH_SRC)/histhash.cpp -c -o $(PATH_BIN)/histhash.o - -$(PATH_BIN)/index.o: $(INDEX_DEP) - $(CC) -I $(PATH_INC) $(DEFINED) $(CCFLAGS) $(PATH_SRC)/index.cpp -c -o $(PATH_BIN)/index.o - -$(PATH_BIN)/join_enumerator.o: $(JOIN_ENUMERATOR_DEP) - $(CC) -I $(PATH_INC) $(DEFINED) $(CCFLAGS) $(PATH_SRC)/join_enumerator.cpp -c -o $(PATH_BIN)/join_enumerator.o - -$(PATH_BIN)/meta.o: $(META_DEP) - $(CC) -I $(PATH_INC) $(DEFINED) $(CCFLAGS) $(PATH_SRC)/meta.cpp -c -o $(PATH_BIN)/meta.o - -$(PATH_BIN)/query.o: $(QUERY_DEP) - $(CC) -I $(PATH_INC) $(DEFINED) $(CCFLAGS) $(PATH_SRC)/query.cpp -c -o $(PATH_BIN)/query.o - -$(PATH_BIN)/relation.o: $(RELATION_DEP) - $(CC) -I $(PATH_INC) $(DEFINED) $(CCFLAGS) $(PATH_SRC)/relation.cpp -c -o $(PATH_BIN)/relation.o - -$(PATH_BIN)/result.o: $(RESULT_DEP) - $(CC) -I $(PATH_INC) $(DEFINED) $(CCFLAGS) $(PATH_SRC)/result.cpp -c -o $(PATH_BIN)/result.o - -$(PATH_BIN)/statistics.o: $(STATISTICS_DEP) - $(CC) -I $(PATH_INC) $(DEFINED) $(CCFLAGS) $(PATH_SRC)/statistics.cpp -c -o $(PATH_BIN)/statistics.o - -$(PATH_BIN)/thread_pool.o: $(THREAD_POOL_DEP) - $(CC) -I $(PATH_INC) $(DEFINED) $(CCFLAGS) $(PATH_SRC)/thread_pool.cpp -c -o $(PATH_BIN)/thread_pool.o - - -OBJS = $(addprefix $(PATH_BIN)/, executioner.o histhash.o index.o join_enumerator.o meta.o query.o relation.o result.o statistics.o thread_pool.o) - -$(PATH_BIN)/%.exe: $(PATH_TEST)/%.cpp $(OBJS) - $(CC) -I $(PATH_INC) $(DEFINED) $(CCFLAGS) $< $(OBJS) $(LIBS) -o $@ diff --git a/src/statistics.cpp b/src/statistics.cpp index 46af6f2..52cbd3f 100644 --- a/src/statistics.cpp +++ b/src/statistics.cpp @@ -295,7 +295,7 @@ void RHJ::Statistics::preprocess(const Query& query) const Query::Predicate& predicate = query.predicates[i]; const tuple_key_t lrel = query.relations[predicate.left.rel], - lcol = query.relations[predicate.left.col]; + lcol = predicate.left.col; const Statistics lold(cache.statistics[lrel][lcol]); @@ -334,7 +334,7 @@ void RHJ::Statistics::preprocess(const Query& query) case Query::Predicate::Type::join_t: const tuple_key_t rrel = query.relations[predicate.right.operand.rel], - rcol = query.relations[predicate.right.operand.col]; + rcol = predicate.right.operand.col; if( lrel == rrel && lcol != rcol ) continue; @@ -365,11 +365,11 @@ float RHJ::Statistics::expected_cost assert(predicate.type == Query::Predicate::Type::join_t); const tuple_key_t lrel = cache.query->relations[predicate.left.rel], - lcol = cache.query->relations[predicate.left.col], + lcol = predicate.left.col, rrel = cache.query->relations[predicate.right.operand.rel], - rcol = cache.query->relations[predicate.right.operand.col]; + rcol = predicate.right.operand.col; - assert(lrel != rrel || lcol == rcol); + //assert(lrel != rrel || lcol == rcol); const Statistics lold(clone[lrel][lcol]), rold(clone[rrel][rcol]); diff --git a/workload/input.txt b/workload/input.txt deleted file mode 100644 index f3a0aaa..0000000 --- a/workload/input.txt +++ /dev/null @@ -1,6 +0,0 @@ -/home/phii/Downloads/myr_folder/myr1.bin -/home/phii/Downloads/myr_folder/myr2.bin -/home/phii/Downloads/myr_folder/myr3.bin -Done -0 1 2|0.0=1.0&1.2>400&2.0=0.0&2.0=2.1|0.0 1.0 -F