# generate build system with debug info and ASAN
CXXFLAGS='-fsanitize=address' hack/hack gen Debug build.debug
# build and run tests
hack/hack test build.debugThis is an object that
- parses a textual representation of a query;
- creates operators (explained below), and wires them up.
For more details, see the test
I really should have called this "Operator", but it's too late when I realized that. This is an interface with two methods:
AttributeNamesRecords
Reads file and parses them.
Calculates a projection (column mapping), then perform that over each input record.
Passes through the input but truncates at specified limit
This made me feel a bit "yuck" because I chose to represent records as a sequence of strings. Anyway, held my nose and sorted by numeric value on the order key.
The JOIN foo a syntax actually leads to two operators:
- a base table scan (FROM) for file
foo - a natural join between the "current" relation and the just-created base table scan on join key
a
Aggregate using a hash table (unordered_map).
Almost the first thing written. Having the two interfaces allowed us to:
- Defer implementing the actual logic of processing data while designing the parsing (Query) class
- Defer implementing the actual file processing logic while designing base table scan (FROM)
- Quickly iterate on the main interface. More iterations led to better designs!
Well, in the absence of a good dependency injection framework, had to write the boring wiring code here.
This is the minimal interface we use to interact with the file system: given a string, return an std::istream
Welp, contact me to change the code, or try the following neat Docker trick:
unzip assignment-data.zip
# this will build our code in a Docker container image, and run it in a container
# If you see a blinking cursor on a blank line, it is ready for query input
# type in queries, or press Ctrl-D to terminate input
hack/test-in-docker