Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
c6a3315
#1 Add create index support in the sql translator
simonstadlinger Jun 23, 2021
5900750
#1 Add basic create index support in bison parser
simonstadlinger Jun 29, 2021
b278a8e
Add Drop Index to sql_translator
m0e33 Jul 3, 2021
2d7d347
Add character varying
simonstadlinger Jul 3, 2021
39da0b5
Add support for all other datatypes
simonstadlinger Jul 3, 2021
241b652
adds keyconstraint functionality
Jostafarr Jul 6, 2021
4e37b38
Add unique types for decimal, real and varchar_varying
m0e33 Jul 6, 2021
e4ec784
added tablekeyconstraint to parser
Jostafarr Jul 6, 2021
5649940
WIP
Jostafarr Jul 6, 2021
b5663d5
refines the tablekeyconstraint implementation
Jostafarr Jul 9, 2021
6331844
started column constraint implementation
Jostafarr Jul 9, 2021
f8007a7
Start implementing Alter Table (Drop Column)
m0e33 Jul 13, 2021
505b94e
column constraint
Jostafarr Jul 14, 2021
32bbbf9
Refactor create_index to actually work
simonstadlinger Jul 15, 2021
b009290
Fix parser to work with new datatypes
simonstadlinger Jul 15, 2021
4e70942
adds keyconstraint functionality
Jostafarr Jul 6, 2021
cdd5e1a
added tablekeyconstraint to parser
Jostafarr Jul 6, 2021
7ccd2ea
WIP
Jostafarr Jul 6, 2021
e3c6c0e
refines the tablekeyconstraint implementation
Jostafarr Jul 9, 2021
79a263a
adds keyconstraint functionality
Jostafarr Jul 6, 2021
4f2ce05
added tablekeyconstraint to parser
Jostafarr Jul 6, 2021
c26be12
WIP
Jostafarr Jul 6, 2021
9dbbdbd
refines the tablekeyconstraint implementation
Jostafarr Jul 9, 2021
fcc65f0
Merge branch 'project/#3-primary-key' of https://github.com/hyrise/sq…
Jostafarr Jul 15, 2021
f04c48c
Merge branch 'project/#4-column-constraint' of https://github.com/hyr…
Jostafarr Jul 15, 2021
94aa80d
Switch if exists flag and index name
simonstadlinger Jul 17, 2021
fa356d2
Merge remote-tracking branch 'origin/project/#1-index' into project/#…
Jostafarr Jul 17, 2021
8a5ad44
Include if_exists flag to drop index
simonstadlinger Jul 17, 2021
6610134
Fix drop index implementation
simonstadlinger Jul 17, 2021
b8a2892
Add Tests
m0e33 Jul 18, 2021
506b161
Add sql translator tests for ALTER TABLE
m0e33 Jul 20, 2021
9cf60b9
Merge remote-tracking branch 'origin/project/#1-index' into project/DDL
m0e33 Jul 20, 2021
67e6d65
Fix decimal
m0e33 Jul 20, 2021
bb31ecc
Merge remote-tracking branch 'origin/Feature/alter-table' into projec…
Jostafarr Jul 20, 2021
dd8211a
Fix failing tests
m0e33 Jul 20, 2021
a394de1
Merge branch 'fix/tests' into project/DDL
m0e33 Jul 20, 2021
e567de1
Rename tableKeyConstraints to tableConstraints
simonstadlinger Aug 24, 2021
dbaf779
Rename snake_case variables to camelCase
simonstadlinger Aug 24, 2021
83d45ac
Introduce time specification for optional precision parameter parsing
simonstadlinger Aug 24, 2021
a1b8861
Change sql translator code for compliance with sql-parser changes
simonstadlinger Aug 24, 2021
910363a
Add small int
simonstadlinger Aug 24, 2021
abc36f1
Introduce table element and thus refactor constraints and column defi…
simonstadlinger Aug 24, 2021
ba5d544
Add support for smallint
m0e33 Aug 24, 2021
5f217ca
Merge remote-tracking branch 'origin/project/#1-index' into project/DDL
m0e33 Aug 24, 2021
b730d77
Fix seg fault
simonstadlinger Aug 24, 2021
b43ca10
Merge remote-tracking branch 'origin/project/#1-index' into project/DDL
m0e33 Aug 24, 2021
fdb7f7d
Fix column constraints to support multiple column constraints and inc…
simonstadlinger Aug 25, 2021
337984e
Merge remote-tracking branch 'origin/project/#1-index' into project/DDL
m0e33 Aug 25, 2021
3fe37ec
Refactor alter table to lay groundwork for more and different action …
simonstadlinger Aug 25, 2021
ff2c1b8
Refactor sql_translator to cope with new alter tble sql statement par…
simonstadlinger Aug 25, 2021
23cd7f4
Implement requested changes
m0e33 Aug 25, 2021
cea6826
Merge remote-tracking branch 'origin/project/#1-index' into project/DDL
m0e33 Aug 25, 2021
b2442c5
Try to fix shift reduce conflict; Failed
simonstadlinger Aug 25, 2021
6d831d6
Remove flex lexer.cpp to resolve conflict
simonstadlinger Aug 25, 2021
393143a
Merge remote-tracking branch 'origin/project/#1-index' into project/DDL
m0e33 Aug 25, 2021
a8f9561
Merge branch 'master' into project/#1-index
simonstadlinger Aug 25, 2021
8cfb689
New bison parser and flex lexer after build
simonstadlinger Aug 25, 2021
2126b0c
Merge remote-tracking branch 'origin/project/#1-index' into project/DDL
m0e33 Aug 25, 2021
6f35609
Fix parsing of drop index and column definitions. Add tests for sql s…
simonstadlinger Aug 25, 2021
44ae7cf
Add flex lexer and bison parser
simonstadlinger Aug 26, 2021
873527d
Add bison_parser and flex_lexer to git
m0e33 Aug 29, 2021
afbb5ab
Merge remote-tracking branch 'origin/project/#1-index' into project/DDL
m0e33 Aug 29, 2021
3ca0ea1
Implement destructor for alter statement
simonstadlinger Aug 29, 2021
e59eb2a
Remove explicit desctructor call for alter statement action
simonstadlinger Aug 30, 2021
18c2282
Merge remote-tracking branch 'origin/project/#1-index' into project/DDL
m0e33 Aug 31, 2021
6cb8491
fixed shift/reduce issue
mweisgut Sep 8, 2021
17bfa16
test
mweisgut Sep 8, 2021
3ce774e
fix
mweisgut Sep 9, 2021
1ca3802
RETURN 1 if valgrind check could not be executed
mweisgut Sep 9, 2021
cab1af7
Merge branch 'mrcl/hotfix/188' into project/#1-index
mweisgut Sep 9, 2021
7b75203
fix
mweisgut Sep 9, 2021
ff5f2f2
../..
mweisgut Sep 9, 2021
1261a11
Merge branch 'mrcl/hotfix/188' into project/#1-index
mweisgut Sep 9, 2021
66dcb87
;;:
mweisgut Sep 9, 2021
6679346
Merge branch 'mrcl/hotfix/188' into project/#1-index
mweisgut Sep 9, 2021
3696353
fix memory allocations, next: fix Mismatched free() / delete / delete
mweisgut Sep 9, 2021
c542723
resolve mismatch free / delete errors
mweisgut Sep 9, 2021
4301e1c
reset test.sh
mweisgut Sep 9, 2021
ab64b8d
delete parser/Makefile changes
mweisgut Sep 9, 2021
b18b021
Merge branch 'project/#1-index' of github.com:hyrise/sql-parser into …
mweisgut Sep 9, 2021
dfd31f2
change enum naming
mweisgut Sep 23, 2021
4474144
Merge branch 'master' into project/#1-index
mweisgut Sep 23, 2021
6ab035a
remove comment about standard
mweisgut Sep 23, 2021
9a81b39
update comment about ON in DROP INDEX
mweisgut Sep 23, 2021
a390c6f
formatting
mweisgut Sep 23, 2021
2ddd374
formatting
mweisgut Sep 23, 2021
b6fe4b8
formatting
mweisgut Sep 23, 2021
1ed4dd2
use join_type
mweisgut Oct 11, 2021
e8b0b71
eliminate VARCHAR_VARYING
mweisgut Oct 11, 2021
05e789b
remove index_name
mweisgut Oct 11, 2021
b7732c0
formatting
mweisgut Oct 11, 2021
5d21bca
enum naming
mweisgut Oct 11, 2021
c2532e7
empty lines
mweisgut Oct 12, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,733 changes: 2,015 additions & 1,718 deletions src/parser/bison_parser.cpp

Large diffs are not rendered by default.

359 changes: 187 additions & 172 deletions src/parser/bison_parser.h

Large diffs are not rendered by default.

325 changes: 212 additions & 113 deletions src/parser/bison_parser.y

Large diffs are not rendered by default.

2,790 changes: 1,427 additions & 1,363 deletions src/parser/flex_lexer.cpp

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/parser/flex_lexer.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#define hsql_HEADER_H 1
#define hsql_IN_HEADER 1

#line 6 "flex_lexer.h"
#line 5 "flex_lexer.h"

#line 8 "flex_lexer.h"
#line 7 "flex_lexer.h"

#define YY_INT_ALIGNED short int

Expand Down Expand Up @@ -730,9 +730,9 @@ extern int yylex \
#undef yyTABLES_NAME
#endif

#line 265 "flex_lexer.l"
#line 270 "flex_lexer.l"


#line 737 "flex_lexer.h"
#line 736 "flex_lexer.h"
#undef hsql_IN_HEADER
#endif /* hsql_HEADER_H */
313 changes: 159 additions & 154 deletions src/parser/flex_lexer.l
Original file line number Diff line number Diff line change
Expand Up @@ -56,165 +56,170 @@ static thread_local std::stringstream strbuf;
***************************/
%%

-- BEGIN(COMMENT);
<COMMENT>[^\n]* /* skipping comment content until a end of line is read */;
<COMMENT>\n BEGIN(INITIAL);
-- BEGIN(COMMENT);
<COMMENT>[^\n]* /* skipping comment content until a end of line is read */;
<COMMENT>\n BEGIN(INITIAL);

[ \t\n]+ /* skip whitespace */;
[ \t\n]+ /* skip whitespace */;

DEALLOCATE TOKEN(DEALLOCATE)
PARAMETERS TOKEN(PARAMETERS)
INTERSECT TOKEN(INTERSECT)
TEMPORARY TOKEN(TEMPORARY)
TIMESTAMP TOKEN(TIMESTAMP)
DESCRIBE TOKEN(DESCRIBE)
DISTINCT TOKEN(DISTINCT)
NVARCHAR TOKEN(NVARCHAR)
RESTRICT TOKEN(RESTRICT)
TRUNCATE TOKEN(TRUNCATE)
ANALYZE TOKEN(ANALYZE)
BETWEEN TOKEN(BETWEEN)
CASCADE TOKEN(CASCADE)
COLUMNS TOKEN(COLUMNS)
CONTROL TOKEN(CONTROL)
DEFAULT TOKEN(DEFAULT)
EXECUTE TOKEN(EXECUTE)
EXPLAIN TOKEN(EXPLAIN)
INTEGER TOKEN(INTEGER)
NATURAL TOKEN(NATURAL)
PREPARE TOKEN(PREPARE)
PRIMARY TOKEN(PRIMARY)
SCHEMAS TOKEN(SCHEMAS)
SPATIAL TOKEN(SPATIAL)
VARCHAR TOKEN(VARCHAR)
VIRTUAL TOKEN(VIRTUAL)
BEFORE TOKEN(BEFORE)
COLUMN TOKEN(COLUMN)
CREATE TOKEN(CREATE)
DELETE TOKEN(DELETE)
DIRECT TOKEN(DIRECT)
DOUBLE TOKEN(DOUBLE)
ESCAPE TOKEN(ESCAPE)
EXCEPT TOKEN(EXCEPT)
EXISTS TOKEN(EXISTS)
EXTRACT TOKEN(EXTRACT)
CAST TOKEN(CAST)
FORMAT TOKEN(FORMAT)
GLOBAL TOKEN(GLOBAL)
HAVING TOKEN(HAVING)
IMPORT TOKEN(IMPORT)
INSERT TOKEN(INSERT)
ISNULL TOKEN(ISNULL)
OFFSET TOKEN(OFFSET)
RENAME TOKEN(RENAME)
SCHEMA TOKEN(SCHEMA)
SELECT TOKEN(SELECT)
SORTED TOKEN(SORTED)
TABLES TOKEN(TABLES)
UNIQUE TOKEN(UNIQUE)
UNLOAD TOKEN(UNLOAD)
UPDATE TOKEN(UPDATE)
VALUES TOKEN(VALUES)
AFTER TOKEN(AFTER)
ALTER TOKEN(ALTER)
ARRAY TOKEN(ARRAY)
CROSS TOKEN(CROSS)
DELTA TOKEN(DELTA)
FLOAT TOKEN(FLOAT)
GROUP TOKEN(GROUP)
INDEX TOKEN(INDEX)
INNER TOKEN(INNER)
LIMIT TOKEN(LIMIT)
LOCAL TOKEN(LOCAL)
MERGE TOKEN(MERGE)
MINUS TOKEN(MINUS)
ORDER TOKEN(ORDER)
OUTER TOKEN(OUTER)
RIGHT TOKEN(RIGHT)
TABLE TOKEN(TABLE)
UNION TOKEN(UNION)
USING TOKEN(USING)
WHERE TOKEN(WHERE)
CALL TOKEN(CALL)
CASE TOKEN(CASE)
CHAR TOKEN(CHAR)
COPY TOKEN(COPY)
DATE TOKEN(DATE)
DATETIME TOKEN(DATETIME)
DESC TOKEN(DESC)
DROP TOKEN(DROP)
ELSE TOKEN(ELSE)
FILE TOKEN(FILE)
FROM TOKEN(FROM)
FULL TOKEN(FULL)
HASH TOKEN(HASH)
HINT TOKEN(HINT)
INTO TOKEN(INTO)
JOIN TOKEN(JOIN)
LEFT TOKEN(LEFT)
LIKE TOKEN(LIKE)
ILIKE TOKEN(ILIKE)
LOAD TOKEN(LOAD)
LONG TOKEN(LONG)
NULL TOKEN(NULL)
PLAN TOKEN(PLAN)
SHOW TOKEN(SHOW)
TEXT TOKEN(TEXT)
THEN TOKEN(THEN)
TIME TOKEN(TIME)
VIEW TOKEN(VIEW)
WHEN TOKEN(WHEN)
WITH TOKEN(WITH)
ADD TOKEN(ADD)
ALL TOKEN(ALL)
AND TOKEN(AND)
ASC TOKEN(ASC)
END TOKEN(END)
FOR TOKEN(FOR)
INT TOKEN(INT)
KEY TOKEN(KEY)
NOT TOKEN(NOT)
OFF TOKEN(OFF)
SET TOKEN(SET)
TOP TOKEN(TOP)
AS TOKEN(AS)
BY TOKEN(BY)
IF TOKEN(IF)
IN TOKEN(IN)
IS TOKEN(IS)
OF TOKEN(OF)
ON TOKEN(ON)
OR TOKEN(OR)
TO TOKEN(TO)
SECOND TOKEN(SECOND)
MINUTE TOKEN(MINUTE)
HOUR TOKEN(HOUR)
DAY TOKEN(DAY)
MONTH TOKEN(MONTH)
YEAR TOKEN(YEAR)
SECONDS TOKEN(SECONDS)
MINUTES TOKEN(MINUTES)
HOURS TOKEN(HOURS)
DAYS TOKEN(DAYS)
MONTHS TOKEN(MONTHS)
YEARS TOKEN(YEARS)
TRUE TOKEN(TRUE)
FALSE TOKEN(FALSE)
DEALLOCATE TOKEN(DEALLOCATE)
PARAMETERS TOKEN(PARAMETERS)
INTERSECT TOKEN(INTERSECT)
TEMPORARY TOKEN(TEMPORARY)
TIMESTAMP TOKEN(TIMESTAMP)
DESCRIBE TOKEN(DESCRIBE)
DISTINCT TOKEN(DISTINCT)
NVARCHAR TOKEN(NVARCHAR)
RESTRICT TOKEN(RESTRICT)
TRUNCATE TOKEN(TRUNCATE)
ANALYZE TOKEN(ANALYZE)
BETWEEN TOKEN(BETWEEN)
CASCADE TOKEN(CASCADE)
COLUMNS TOKEN(COLUMNS)
CONTROL TOKEN(CONTROL)
DEFAULT TOKEN(DEFAULT)
EXECUTE TOKEN(EXECUTE)
EXPLAIN TOKEN(EXPLAIN)
INTEGER TOKEN(INTEGER)
NATURAL TOKEN(NATURAL)
PREPARE TOKEN(PREPARE)
PRIMARY TOKEN(PRIMARY)
SCHEMAS TOKEN(SCHEMAS)
SPATIAL TOKEN(SPATIAL)
VARCHAR TOKEN(VARCHAR)
CHARACTER TOKEN(CHARACTER)
VARYING TOKEN(VARYING)
TIME TOKEN(TIME)
DECIMAL TOKEN(DECIMAL)
REAL TOKEN(REAL)
VIRTUAL TOKEN(VIRTUAL)
BEFORE TOKEN(BEFORE)
COLUMN TOKEN(COLUMN)
CREATE TOKEN(CREATE)
DELETE TOKEN(DELETE)
DIRECT TOKEN(DIRECT)
DOUBLE TOKEN(DOUBLE)
ESCAPE TOKEN(ESCAPE)
EXCEPT TOKEN(EXCEPT)
EXISTS TOKEN(EXISTS)
EXTRACT TOKEN(EXTRACT)
CAST TOKEN(CAST)
FORMAT TOKEN(FORMAT)
GLOBAL TOKEN(GLOBAL)
HAVING TOKEN(HAVING)
IMPORT TOKEN(IMPORT)
INSERT TOKEN(INSERT)
ISNULL TOKEN(ISNULL)
OFFSET TOKEN(OFFSET)
RENAME TOKEN(RENAME)
SCHEMA TOKEN(SCHEMA)
SELECT TOKEN(SELECT)
SORTED TOKEN(SORTED)
TABLES TOKEN(TABLES)
UNIQUE TOKEN(UNIQUE)
UNLOAD TOKEN(UNLOAD)
UPDATE TOKEN(UPDATE)
VALUES TOKEN(VALUES)
AFTER TOKEN(AFTER)
ALTER TOKEN(ALTER)
ARRAY TOKEN(ARRAY)
CROSS TOKEN(CROSS)
DELTA TOKEN(DELTA)
FLOAT TOKEN(FLOAT)
GROUP TOKEN(GROUP)
INDEX TOKEN(INDEX)
INNER TOKEN(INNER)
LIMIT TOKEN(LIMIT)
LOCAL TOKEN(LOCAL)
MERGE TOKEN(MERGE)
MINUS TOKEN(MINUS)
ORDER TOKEN(ORDER)
OUTER TOKEN(OUTER)
RIGHT TOKEN(RIGHT)
TABLE TOKEN(TABLE)
UNION TOKEN(UNION)
USING TOKEN(USING)
WHERE TOKEN(WHERE)
CALL TOKEN(CALL)
CASE TOKEN(CASE)
CHAR TOKEN(CHAR)
COPY TOKEN(COPY)
DATE TOKEN(DATE)
DATETIME TOKEN(DATETIME)
DESC TOKEN(DESC)
DROP TOKEN(DROP)
ELSE TOKEN(ELSE)
FILE TOKEN(FILE)
FROM TOKEN(FROM)
FULL TOKEN(FULL)
HASH TOKEN(HASH)
HINT TOKEN(HINT)
INTO TOKEN(INTO)
JOIN TOKEN(JOIN)
LEFT TOKEN(LEFT)
LIKE TOKEN(LIKE)
ILIKE TOKEN(ILIKE)
LOAD TOKEN(LOAD)
LONG TOKEN(LONG)
NULL TOKEN(NULL)
PLAN TOKEN(PLAN)
SHOW TOKEN(SHOW)
TEXT TOKEN(TEXT)
THEN TOKEN(THEN)
TIME TOKEN(TIME)
VIEW TOKEN(VIEW)
WHEN TOKEN(WHEN)
WITH TOKEN(WITH)
ADD TOKEN(ADD)
ALL TOKEN(ALL)
AND TOKEN(AND)
ASC TOKEN(ASC)
END TOKEN(END)
FOR TOKEN(FOR)
INT TOKEN(INT)
KEY TOKEN(KEY)
NOT TOKEN(NOT)
OFF TOKEN(OFF)
SET TOKEN(SET)
TOP TOKEN(TOP)
AS TOKEN(AS)
BY TOKEN(BY)
IF TOKEN(IF)
IN TOKEN(IN)
IS TOKEN(IS)
OF TOKEN(OF)
ON TOKEN(ON)
OR TOKEN(OR)
TO TOKEN(TO)
SECOND TOKEN(SECOND)
MINUTE TOKEN(MINUTE)
HOUR TOKEN(HOUR)
DAY TOKEN(DAY)
MONTH TOKEN(MONTH)
YEAR TOKEN(YEAR)
SECONDS TOKEN(SECONDS)
MINUTES TOKEN(MINUTES)
HOURS TOKEN(HOURS)
DAYS TOKEN(DAYS)
MONTHS TOKEN(MONTHS)
YEARS TOKEN(YEARS)
TRUE TOKEN(TRUE)
FALSE TOKEN(FALSE)
TRANSACTION TOKEN(TRANSACTION)
BEGIN TOKEN(BEGIN)
ROLLBACK TOKEN(ROLLBACK)
COMMIT TOKEN(COMMIT)
INTERVAL TOKEN(INTERVAL)
BEGIN TOKEN(BEGIN)
ROLLBACK TOKEN(ROLLBACK)
COMMIT TOKEN(COMMIT)
INTERVAL TOKEN(INTERVAL)

/* Allow =/== see https://sqlite.org/lang_expr.html#collateop */
"==" TOKEN(EQUALS)
"!=" TOKEN(NOTEQUALS)
"<>" TOKEN(NOTEQUALS)
"<=" TOKEN(LESSEQ)
">=" TOKEN(GREATEREQ)
"||" TOKEN(CONCAT)
/* Allow =/== see https://sqlite.org/lang_expr.html#collateop */
"==" TOKEN(EQUALS)
"!=" TOKEN(NOTEQUALS)
"<>" TOKEN(NOTEQUALS)
"<=" TOKEN(LESSEQ)
">=" TOKEN(GREATEREQ)
"||" TOKEN(CONCAT)

[-+*/(){},.;<>=^%:?[\]|] { return yytext[0]; }
[-+*/(){},.;<>=^%:?[\]|] { return yytext[0]; }

[0-9]+"."[0-9]* |
"."[0-9]* {
Expand Down
41 changes: 41 additions & 0 deletions src/sql/AlterStatement.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#ifndef SQLPARSER_ALTER_STATEMENT_H
#define SQLPARSER_ALTER_STATEMENT_H

#include "SQLStatement.h"

// Note: Implementations of constructors and destructors can be found in statements.cpp.
namespace hsql {

enum ActionType {
DropColumn,
};

struct AlterAction {
AlterAction(ActionType type);
ActionType type;
virtual ~AlterAction();
};

struct DropColumnAction : AlterAction {
DropColumnAction(char* column_name);
char* columnName;
bool ifExists;

~DropColumnAction() override;
};

// Represents SQL Alter Table statements.
// Example "ALTER TABLE students DROP COLUMN name;"
struct AlterStatement : SQLStatement {

AlterStatement(char* name, AlterAction* action);
~AlterStatement() override;

char* schema;
bool ifTableExists;
char* name;
AlterAction* action;
};
} // namespace hsql

#endif
Loading