Skip to content

Commit 4a052f1

Browse files
authored
Added comments (#20)
* âdd comments to tpch_pgsql.py * minor changes to Makefile (blanks) * move default values for command line argument to top * rename folder modules to tpch4pgsql * move class Password from postgresqldb.py to tpch_pgsql.py * add comments to query.py * added Sphinx
1 parent 4cf35a5 commit 4a052f1

File tree

12 files changed

+536
-106
lines changed

12 files changed

+536
-106
lines changed

Makefile

+12-12
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,17 @@
100100
################
101101
## CHANGE NAME OF ANSI COMPILER HERE
102102
################
103-
CC=gcc
103+
CC=gcc
104104
# Current values for DATABASE are: INFORMIX, DB2, TDAT (Teradata)
105105
# SQLSERVER, SYBASE, ORACLE
106-
# Current values for MACHINE are: ATT, DOS, HP, IBM, ICL, MVS,
107-
# SGI, SUN, U2200, VMS, LINUX, WIN32
106+
# Current values for MACHINE are: ATT, DOS, HP, IBM, ICL, MVS,
107+
# SGI, SUN, U2200, VMS, LINUX, WIN32
108108
# Current values for WORKLOAD are: TPCH
109109
DATABASE=ORACLE
110110
MACHINE=LINUX
111111
WORKLOAD=TPCH
112112
#
113-
CFLAGS = -g -DDBNAME=\"dss\" -D$(MACHINE) -D$(DATABASE) -D$(WORKLOAD) -DRNG_TEST -D_FILE_OFFSET_BITS=64
113+
CFLAGS = -g -DDBNAME=\"dss\" -D$(MACHINE) -D$(DATABASE) -D$(WORKLOAD) -DRNG_TEST -D_FILE_OFFSET_BITS=64
114114
LDFLAGS = -O
115115
# The OBJ,EXE and LIB macros will need to be changed for compilation under
116116
# Windows NT
@@ -137,7 +137,7 @@ HDR = $(HDR1) $(HDR2)
137137
#
138138
SRC1 = build.c driver.c bm_utils.c rnd.c print.c load_stub.c bcd2.c \
139139
speed_seed.c text.c permute.c rng64.c
140-
SRC2 = qgen.c varsub.c
140+
SRC2 = qgen.c varsub.c
141141
SRC = $(SRC1) $(SRC2)
142142
#
143143
OBJ1 = build$(OBJ) driver$(OBJ) bm_utils$(OBJ) rnd$(OBJ) print$(OBJ) \
@@ -147,7 +147,7 @@ OBJ2 = build$(OBJ) bm_utils$(OBJ) qgen$(OBJ) rnd$(OBJ) varsub$(OBJ) \
147147
text$(OBJ) bcd2$(OBJ) permute$(OBJ) speed_seed$(OBJ) rng64$(OBJ)
148148
OBJS = $(OBJ1) $(OBJ2)
149149
#
150-
SETS = dists.dss
150+
SETS = dists.dss
151151
DOC=README HISTORY PORTING.NOTES BUGS
152152
DDL = dss.ddl dss.ri
153153
WINDOWS_IDE = tpch.dsw dbgen.dsp tpch.sln tpch.vcproj qgen.vcproj
@@ -160,7 +160,7 @@ FQD=queries/1.sql queries/2.sql queries/3.sql queries/4.sql queries/5.sql querie
160160
queries/8.sql queries/9.sql queries/10.sql queries/11.sql queries/12.sql queries/13.sql \
161161
queries/14.sql queries/15.sql queries/16.sql queries/17.sql queries/18.sql queries/19.sql queries/20.sql \
162162
queries/21.sql queries/22.sql
163-
VARIANTS= variants/8a.sql variants/12a.sql variants/13a.sql variants/14a.sql variants/15a.sql
163+
VARIANTS= variants/8a.sql variants/12a.sql variants/13a.sql variants/14a.sql variants/15a.sql
164164
ANS = answers/q1.out answers/q2.out answers/q3.out answers/q4.out answers/q5.out answers/q6.out answers/q7.out answers/q8.out \
165165
answers/q9.out answers/q10.out answers/q11.out answers/q12.out answers/q13.out answers/q14.out answers/q15.out \
166166
answers/q16.out answers/q17.out answers/q18.out answers/q19.out answers/q20.out answers/q21.out answers/q22.out
@@ -170,26 +170,26 @@ REFERENCE=reference/[tcR]*
170170
REFERENCE_DATA=referenceData/[13]*
171171
SCRIPTS= check55.sh column_split.sh dop.sh gen_tasks.sh last_row.sh load_balance.sh new55.sh check_dirs.sh
172172
ALLSRC=$(DBGENSRC) $(REFERENCE) $(QSRC) $(SCRIPTS)
173-
JUNK =
173+
JUNK =
174174
#
175175
all: $(PROGS)
176-
$(PROG1): $(OBJ1) $(SETS)
176+
$(PROG1): $(OBJ1) $(SETS)
177177
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJ1) $(LIBS)
178-
$(PROG2): permute.h $(OBJ2)
178+
$(PROG2): permute.h $(OBJ2)
179179
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJ2) $(LIBS)
180180
clean:
181181
rm -f $(PROGS) $(OBJS) $(JUNK)
182182
lint:
183183
lint $(CFLAGS) -u -x -wO -Ma -p $(SRC1)
184184
lint $(CFLAGS) -u -x -wO -Ma -p $(SRC2)
185185

186-
tar: $(ALLSRC)
186+
tar: $(ALLSRC)
187187
tar cvhf - $(ALLSRC) --exclude .svn\*/\* |gzip - > tpch_${VERSION}_${RELEASE}_${PATCH}.tar.gz
188188
tar cvhf - $(REFERENCE_DATA) --exclude .svn\*/\* |gzip - > reference_${VERSION}_${RELEASE}_${PATCH}.tar.gz
189189
zip: $(ALLSRC)
190190
zip -r tpch_${VERSION}_${RELEASE}_${PATCH}.zip $(ALLSRC) -x *.svn*
191191
zip -r reference_${VERSION}_${RELEASE}_${PATCH}.zip $(REFERENCE_DATA) -x *.svn*
192-
release:
192+
release:
193193
make -f makefile.suite tar
194194
make -f makefile.suite zip
195195
( cd tests; sh test_list.sh `date '+%Y%m%d'` )

docs/Makefile

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line.
5+
SPHINXOPTS =
6+
SPHINXBUILD = sphinx-build
7+
SPHINXPROJ = TPC-HforPostgreSQL
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/make.bat

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
set SPHINXPROJ=TPC-HforPostgreSQL
13+
14+
if "%1" == "" goto help
15+
16+
%SPHINXBUILD% >NUL 2>NUL
17+
if errorlevel 9009 (
18+
echo.
19+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
20+
echo.installed, then set the SPHINXBUILD environment variable to point
21+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
22+
echo.may add the Sphinx directory to PATH.
23+
echo.
24+
echo.If you don't have Sphinx installed, grab it from
25+
echo.http://sphinx-doc.org/
26+
exit /b 1
27+
)
28+
29+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
30+
goto end
31+
32+
:help
33+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
34+
35+
:end
36+
popd

docs/source/conf.py

+165
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# Configuration file for the Sphinx documentation builder.
4+
#
5+
# This file does only contain a selection of the most common options. For a
6+
# full list see the documentation:
7+
# http://www.sphinx-doc.org/en/master/config
8+
9+
# -- Path setup --------------------------------------------------------------
10+
11+
# If extensions (or modules to document with autodoc) are in another directory,
12+
# add these directories to sys.path here. If the directory is relative to the
13+
# documentation root, use os.path.abspath to make it absolute, like shown here.
14+
#
15+
# import os
16+
# import sys
17+
# sys.path.insert(0, os.path.abspath('.'))
18+
19+
20+
# -- Project information -----------------------------------------------------
21+
22+
project = 'TPC-H for PostgreSQL'
23+
copyright = '2018, Sohaib Iftakhar, Slavo Nagy'
24+
author = 'Sohaib Iftakhar, Slavo Nagy'
25+
26+
# The short X.Y version
27+
version = ''
28+
# The full version, including alpha/beta/rc tags
29+
release = '0.1'
30+
31+
32+
# -- General configuration ---------------------------------------------------
33+
34+
# If your documentation needs a minimal Sphinx version, state it here.
35+
#
36+
# needs_sphinx = '1.0'
37+
38+
# Add any Sphinx extension module names here, as strings. They can be
39+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
40+
# ones.
41+
extensions = [
42+
'sphinx.ext.todo',
43+
'sphinx.ext.coverage',
44+
]
45+
46+
# Add any paths that contain templates here, relative to this directory.
47+
templates_path = ['_templates']
48+
49+
# The suffix(es) of source filenames.
50+
# You can specify multiple suffix as a list of string:
51+
#
52+
# source_suffix = ['.rst', '.md']
53+
source_suffix = '.rst'
54+
55+
# The master toctree document.
56+
master_doc = 'index'
57+
58+
# The language for content autogenerated by Sphinx. Refer to documentation
59+
# for a list of supported languages.
60+
#
61+
# This is also used if you do content translation via gettext catalogs.
62+
# Usually you set "language" from the command line for these cases.
63+
language = None
64+
65+
# List of patterns, relative to source directory, that match files and
66+
# directories to ignore when looking for source files.
67+
# This pattern also affects html_static_path and html_extra_path .
68+
exclude_patterns = []
69+
70+
# The name of the Pygments (syntax highlighting) style to use.
71+
pygments_style = 'sphinx'
72+
73+
74+
# -- Options for HTML output -------------------------------------------------
75+
76+
# The theme to use for HTML and HTML Help pages. See the documentation for
77+
# a list of builtin themes.
78+
#
79+
html_theme = 'alabaster'
80+
81+
# Theme options are theme-specific and customize the look and feel of a theme
82+
# further. For a list of options available for each theme, see the
83+
# documentation.
84+
#
85+
# html_theme_options = {}
86+
87+
# Add any paths that contain custom static files (such as style sheets) here,
88+
# relative to this directory. They are copied after the builtin static files,
89+
# so a file named "default.css" will overwrite the builtin "default.css".
90+
html_static_path = ['_static']
91+
92+
# Custom sidebar templates, must be a dictionary that maps document names
93+
# to template names.
94+
#
95+
# The default sidebars (for documents that don't match any pattern) are
96+
# defined by theme itself. Builtin themes are using these templates by
97+
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
98+
# 'searchbox.html']``.
99+
#
100+
# html_sidebars = {}
101+
102+
103+
# -- Options for HTMLHelp output ---------------------------------------------
104+
105+
# Output file base name for HTML help builder.
106+
htmlhelp_basename = 'TPC-HforPostgreSQLdoc'
107+
108+
109+
# -- Options for LaTeX output ------------------------------------------------
110+
111+
latex_elements = {
112+
# The paper size ('letterpaper' or 'a4paper').
113+
#
114+
# 'papersize': 'letterpaper',
115+
116+
# The font size ('10pt', '11pt' or '12pt').
117+
#
118+
# 'pointsize': '10pt',
119+
120+
# Additional stuff for the LaTeX preamble.
121+
#
122+
# 'preamble': '',
123+
124+
# Latex figure (float) alignment
125+
#
126+
# 'figure_align': 'htbp',
127+
}
128+
129+
# Grouping the document tree into LaTeX files. List of tuples
130+
# (source start file, target name, title,
131+
# author, documentclass [howto, manual, or own class]).
132+
latex_documents = [
133+
(master_doc, 'TPC-HforPostgreSQL.tex', 'TPC-H for PostgreSQL Documentation',
134+
'Sohaib Iftakhar, Slavo Nagy', 'manual'),
135+
]
136+
137+
138+
# -- Options for manual page output ------------------------------------------
139+
140+
# One entry per manual page. List of tuples
141+
# (source start file, name, description, authors, manual section).
142+
man_pages = [
143+
(master_doc, 'tpc-hforpostgresql', 'TPC-H for PostgreSQL Documentation',
144+
[author], 1)
145+
]
146+
147+
148+
# -- Options for Texinfo output ----------------------------------------------
149+
150+
# Grouping the document tree into Texinfo files. List of tuples
151+
# (source start file, target name, title, author,
152+
# dir menu entry, description, category)
153+
texinfo_documents = [
154+
(master_doc, 'TPC-HforPostgreSQL', 'TPC-H for PostgreSQL Documentation',
155+
author, 'TPC-HforPostgreSQL', 'One line description of project.',
156+
'Miscellaneous'),
157+
]
158+
159+
160+
# -- Extension configuration -------------------------------------------------
161+
162+
# -- Options for todo extension ----------------------------------------------
163+
164+
# If true, `todo` and `todoList` produce output, else they produce nothing.
165+
todo_include_todos = True

docs/source/index.rst

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.. TPC-H for PostgreSQL documentation master file, created by
2+
sphinx-quickstart on Mon Jul 30 14:09:56 2018.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
Welcome to TPC-H for PostgreSQL's documentation!
7+
================================================
8+
9+
.. toctree::
10+
:maxdepth: 2
11+
:caption: Contents:
12+
13+
14+
15+
Indices and tables
16+
==================
17+
18+
* :ref:`genindex`
19+
* :ref:`modindex`
20+
* :ref:`search`

tests/test_tpch_pgsql.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import mock
77

88
import tpch_pgsql as bm
9-
from modules import query
9+
from tpch4pgsql import query
1010

1111

1212
class TestBenchmark(unittest.TestCase):

modules/load.py renamed to tpch4pgsql/load.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import os
2-
from modules import postgresqldb as pgdb
2+
from tpch4pgsql import postgresqldb as pgdb
33

44

55
def clean_database(query_root, host, port, db_name, user, password, tables):

modules/postgresqldb.py renamed to tpch4pgsql/postgresqldb.py

+2-10
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
1-
import argparse
21
import psycopg2
32

43

5-
class Password(argparse.Action):
6-
# TODO: add comment
7-
def __call__(self, parser, namespace, values, option_string):
8-
if values is None:
9-
values = getpass.getpass()
10-
setattr(namespace, self.dest, values)
11-
12-
134
class PGDB:
14-
# TODO: add comment
5+
"""Class for connections to PostgreSQL database
6+
"""
157
__connection__ = None
168
__cursor__ = None
179

File renamed without changes.

0 commit comments

Comments
 (0)