Some Linux distributions (e.g. Centos) don't have bc installed by
default. And some (e.g Centos 8) don't have binary packages for it
available either. It's safer to use awk instead of bc to check
versions of bison and flex in the parser Makefile.
Closes#144
This should fix multi-threaded parsing. Not a clean solution, I am guessing the following block should be a single, state-less pattern? @mrks
```
\' { BEGIN singlequotedstring; strbuf = std::stringstream{}; }
<singlequotedstring>\'\' { strbuf << '\''; }
<singlequotedstring>[^']* { strbuf << yytext; }
<singlequotedstring>\' { BEGIN 0; yylval->sval = strdup(strbuf.str().c_str()); return SQL_STRING; }
<singlequotedstring><<EOF>> { fprintf(stderr, "[SQL-Lexer-Error] Unterminated string\n"); return 0; }
```
Anyway, the following hyrise playground does not crash anymore, so Toni should be able to work with this for the time being.
```c++
#include <iostream>
#include <thread>
#include "types.hpp"
#include "tpch/tpch_queries.hpp"
#include "SQLParser.h"
using namespace opossum; // NOLINT
int main() {
std::vector<std::thread> threads;
for (size_t t = 0; t < 200; ++t) {
threads.emplace_back([&]() {
for (size_t p = 0; p < 10'000; ++p) {
hsql::SQLParserResult result;
hsql::SQLParser::parse(tpch_queries.at(19), &result);
std::cout << "Parsing " << p << " is valid: " << result.isValid() << std::endl;
}
});
}
for (auto& thread : threads) {
thread.join();
}
return 0;
}
```
In addtion to already supported LIMIT/OFFSET variants allow more to be parsed
Legacy:
- LIMIT int
- LIMIT int OFFSET int
Enhancement:
- OFFSET int (no limit)
- LIMIT ALL (no limit)
- LIMIT NULL (no limit)
- LIMIT ALL OFFSET int (no limit, but offset)
- LIMIT NULL OFFSET int (no limit, but offset)
Also ensures negative limits / offsets are set to kNoLimit/kNoOffset
Consolidate LeftOuter/Left and RightOuter/Right as they are
by definition the same.
Similar consolidate FullOuter/Outer/Full ... with Outer (as in the
parser) not part of standard, but "full" missing. Allowing all three.
This commit potentially breaks other programs as kJoinLeftOuter and kJoinRightOuter
are eliminated
- allow multiple WHEN statements
- allow for syntax like `CASE x WHEN 1 THEN 2 WHEN 3 THEN 4 ELSE 5 END`
NOTE: This changes also the way the CASE operator is stored:
- CASE [expr] exprList [ELSE expr2] END
- exprList holds each of the WHEN statements with:
expr := WHEN, expr2 := THEN
Added also tests in test/select_tests.cpp
and adapted the existing one to reflect the new storage