Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LDI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eva Feng
LDI
Commits
d00a16cc
Commit
d00a16cc
authored
5 years ago
by
w328li
Browse files
Options
Downloads
Patches
Plain Diff
add create_operator
parent
5689dc78
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
SQLPGrammar_new.tab.c
+133
-70
133 additions, 70 deletions
SQLPGrammar_new.tab.c
SQLPGrammar_new.y
+28
-0
28 additions, 0 deletions
SQLPGrammar_new.y
SQLPParser_new
+0
-0
0 additions, 0 deletions
SQLPParser_new
with
161 additions
and
70 deletions
SQLPGrammar_new.tab.c
+
133
−
70
View file @
d00a16cc
...
...
@@ -513,11 +513,11 @@ static const yytype_uint8 yytranslate[] =
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static
const
yytype_uint16
yyrline
[]
=
{
0
,
26
,
26
,
36
,
41
,
46
,
51
,
59
,
6
0
,
6
1
,
62
,
66
,
6
7
,
68
,
72
,
77
,
86
,
91
,
96
,
1
04
,
1
09
,
1
10
,
1
15
,
1
19
,
1
26
,
1
31
,
1
38
,
14
6
,
1
53
,
1
60
,
1
65
,
1
70
,
175
,
180
,
185
,
193
,
198
,
2
06
,
2
11
,
2
18
,
2
2
5
,
2
30
,
23
5
,
2
42
,
2
4
7
,
25
7
,
2
62
,
2
67
0
,
26
,
26
,
36
,
41
,
46
,
51
,
59
,
6
4
,
6
9
,
74
,
82
,
8
7
,
92
,
100
,
105
,
114
,
119
,
124
,
1
32
,
1
37
,
1
38
,
1
43
,
1
47
,
1
54
,
1
59
,
1
66
,
1
7
4
,
1
81
,
1
88
,
1
93
,
1
98
,
203
,
208
,
213
,
221
,
226
,
2
34
,
2
39
,
2
46
,
25
3
,
2
58
,
2
6
3
,
2
70
,
27
5
,
2
8
5
,
2
90
,
2
95
};
#endif
...
...
@@ -1399,298 +1399,361 @@ yyreduce:
#line 1400 "SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
7
:
#line 60 "SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"SelectQuery 1
\n
"
);
(
yyval
)
=
(
yyvsp
[
0
]);
}
#line 1409 "SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
8
:
#line 65 "SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"SelectQuery 2
\n
"
);
(
yyval
)
=
create_proj_operator
((
yyvsp
[
-
1
]),
(
yyvsp
[
0
]));
}
#line 1418 "SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
9
:
#line 70 "SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"SelectList 3
\n
"
);
(
yyval
)
=
(
yyvsp
[
0
]);
}
#line 1427 "SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
10
:
#line 75 "SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"SelectList 4
\n
"
);
(
yyval
)
=
create_proj_operator
((
yyvsp
[
-
2
]),
(
yyvsp
[
-
1
]));
}
#line 1436 "SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
11
:
#line 83 "SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"Body 1
\n
"
);
(
yyval
)
=
(
yyvsp
[
0
]);
}
#line 1445 "SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
12
:
#line 88 "SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"Body 2
\n
"
);
// todo
}
#line 1454 "SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
13
:
#line 93 "SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"Body 3
\n
"
);
(
yyval
)
=
create_eval_operator
((
yyvsp
[
0
]),
(
yyvsp
[
-
2
]));
}
#line 1463 "SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
14
:
#line
73
"SQLPGrammar_new.y"
/* yacc.c:1646 */
#line
101
"SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"TableList 1
\n
"
);
(
yyval
)
=
create_rename_operator
((
yyvsp
[
-
1
]),
(
yyvsp
[
0
]));
}
#line 14
09
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
#line 14
72
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
15
:
#line
78
"SQLPGrammar_new.y"
/* yacc.c:1646 */
#line
106
"SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"TableList 2
\n
"
);
(
yyval
)
=
create_cross_operator
(
create_rename_operator
((
yyvsp
[
-
3
]),
(
yyvsp
[
-
2
])),
(
yyvsp
[
0
]));
}
#line 14
1
8 "SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
#line 148
1
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
16
:
#line
87
"SQLPGrammar_new.y"
/* yacc.c:1646 */
#line
115
"SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"UnionQuery 1
\n
"
);
(
yyval
)
=
create_union_all_operator
((
yyvsp
[
-
3
]),
(
yyvsp
[
0
]));
}
#line 14
27
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
#line 14
90
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
17
:
#line
92
"SQLPGrammar_new.y"
/* yacc.c:1646 */
#line
120
"SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"UnionQuery 2
\n
"
);
(
yyval
)
=
create_union_all_operator
((
yyvsp
[
-
3
]),
(
yyvsp
[
0
]));
}
#line 14
36
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
#line 14
99
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
18
:
#line
97
"SQLPGrammar_new.y"
/* yacc.c:1646 */
#line
125
"SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"UnionQuery 3
\n
"
);
(
yyval
)
=
(
yyvsp
[
-
2
]);
}
#line 1
445
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
#line 1
508
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
19
:
#line 1
05
"SQLPGrammar_new.y"
/* yacc.c:1646 */
#line 1
33
"SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"SelectList 2
\n
"
);
(
yyval
)
=
create_rename_operator
((
yyvsp
[
0
]),
NULL
);
}
#line 1
454
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
#line 1
517
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
21
:
#line 1
11
"SQLPGrammar_new.y"
/* yacc.c:1646 */
#line 1
39
"SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"SelectList 4
\n
"
);
(
yyval
)
=
create_rename_operator
((
yyvsp
[
-
2
]),
(
yyvsp
[
-
1
]));
}
#line 1
463
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
#line 1
526
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
23
:
#line 1
20
"SQLPGrammar_new.y"
/* yacc.c:1646 */
#line 1
48
"SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"col
\n
"
);
(
yyval
)
=
create_spcol
((
yyvsp
[
-
2
]),
(
yyvsp
[
0
]));
}
#line 1
472
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
#line 1
535
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
24
:
#line 1
27
"SQLPGrammar_new.y"
/* yacc.c:1646 */
#line 1
55
"SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"AttrPath 1
\n
"
);
(
yyval
)
=
create_pf
((
yyvsp
[
0
]),
NULL
);
}
#line 1
481
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
#line 1
544
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
25
:
#line 1
32
"SQLPGrammar_new.y"
/* yacc.c:1646 */
#line 1
60
"SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"AttrPath 2
\n
"
);
(
yyval
)
=
create_pf
((
yyvsp
[
-
2
]),
(
yyvsp
[
0
]));
}
#line 1
490
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
#line 1
553
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
26
:
#line 1
39
"SQLPGrammar_new.y"
/* yacc.c:1646 */
#line 1
67
"SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"VarIdentifier is |%s| "
,
yytext
);
(
yyval
)
=
create_var
(
yytext
);
}
#line 1
499
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
#line 1
562
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
27
:
#line 1
4
7 "SQLPGrammar_new.y"
/* yacc.c:1646 */
#line 17
5
"SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"TableIdentifier is |%s| "
,
yytext
);
(
yyval
)
=
create_var
(
yytext
);
}
#line 15
08
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
#line 15
71
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
28
:
#line 1
54
"SQLPGrammar_new.y"
/* yacc.c:1646 */
#line 1
82
"SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"AttrIdentifier is |%s| "
,
yytext
);
(
yyval
)
=
create_var
(
yytext
);
}
#line 15
17
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
#line 15
80
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
29
:
#line 1
61
"SQLPGrammar_new.y"
/* yacc.c:1646 */
#line 1
89
"SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"CompOperator EQ
\n
"
);
(
yyval
)
=
create_op
(
yytext
);
}
#line 15
26
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
#line 15
89
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
30
:
#line 1
66
"SQLPGrammar_new.y"
/* yacc.c:1646 */
#line 1
94
"SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"CompOperator NE
\n
"
);
(
yyval
)
=
create_op
(
yytext
);
}
#line 15
35
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
#line 15
98
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
31
:
#line 1
71
"SQLPGrammar_new.y"
/* yacc.c:1646 */
#line 1
99
"SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"CompOperator LE
\n
"
);
(
yyval
)
=
create_op
(
yytext
);
}
#line 1
544
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
#line 1
607
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
32
:
#line
176
"SQLPGrammar_new.y"
/* yacc.c:1646 */
#line
204
"SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"CompOperator GE
\n
"
);
(
yyval
)
=
create_op
(
yytext
);
}
#line 1
553
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
#line 1
616
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
33
:
#line
181
"SQLPGrammar_new.y"
/* yacc.c:1646 */
#line
209
"SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"CompOperator LT
\n
"
);
(
yyval
)
=
create_op
(
yytext
);
}
#line 1
5
62 "SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
#line 162
5
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
34
:
#line
186
"SQLPGrammar_new.y"
/* yacc.c:1646 */
#line
214
"SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"CompOperator GT
\n
"
);
(
yyval
)
=
create_op
(
yytext
);
}
#line 1
571
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
#line 1
634
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
35
:
#line
194
"SQLPGrammar_new.y"
/* yacc.c:1646 */
#line
222
"SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"Pred 1
\n
"
);
(
yyval
)
=
(
yyvsp
[
0
]);
}
#line 1
580
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
#line 1
643
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
36
:
#line
199
"SQLPGrammar_new.y"
/* yacc.c:1646 */
#line
227
"SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"Pred 2
\n
"
);
(
yyval
)
=
create_or_operator
((
yyvsp
[
-
2
]),
(
yyvsp
[
0
]));
}
#line 1
589
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
#line 1
652
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
37
:
#line 2
07
"SQLPGrammar_new.y"
/* yacc.c:1646 */
#line 2
35
"SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"Conj 1
\n
"
);
(
yyval
)
=
(
yyvsp
[
0
]);
}
#line 1
598
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
#line 1
661
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
38
:
#line 2
12
"SQLPGrammar_new.y"
/* yacc.c:1646 */
#line 2
40
"SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"Conj 2
\n
"
);
(
yyval
)
=
create_and_operator
((
yyvsp
[
-
2
]),
(
yyvsp
[
0
]));
}
#line 16
0
7 "SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
#line 167
0
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
39
:
#line 2
19
"SQLPGrammar_new.y"
/* yacc.c:1646 */
#line 2
47
"SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"BasicPred 1
\n
"
);
cons_cell
*
first_term
=
create_term
((
yyvsp
[
-
2
]));
cons_cell
*
second_term
=
create_term
((
yyvsp
[
0
]));
(
yyval
)
=
create_comp_operator
((
yyvsp
[
-
1
]),
first_term
,
second_term
,
NULL
);
}
#line 16
1
8 "SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
#line 168
1
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
40
:
#line 2
26
"SQLPGrammar_new.y"
/* yacc.c:1646 */
#line 2
54
"SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"BasicPred 2
\n
"
);
(
yyval
)
=
create_exist_operator
((
yyvsp
[
-
2
]));
}
#line 16
27
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
#line 16
90
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
41
:
#line 2
31
"SQLPGrammar_new.y"
/* yacc.c:1646 */
#line 2
59
"SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"BasicPred 3
\n
"
);
(
yyval
)
=
create_not_operator
((
yyvsp
[
0
]));
}
#line 16
36
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
#line 16
99
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
42
:
#line 2
3
6 "SQLPGrammar_new.y"
/* yacc.c:1646 */
#line 26
4
"SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"BasicPred 4
\n
"
);
(
yyval
)
=
(
yyvsp
[
-
2
]);
}
#line 1
645
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
#line 1
708
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
43
:
#line 2
43
"SQLPGrammar_new.y"
/* yacc.c:1646 */
#line 2
71
"SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"Term 1
\n
"
);
(
yyval
)
=
(
yyvsp
[
0
]);
}
#line 1
654
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
#line 1
717
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
44
:
#line 2
48
"SQLPGrammar_new.y"
/* yacc.c:1646 */
#line 2
76
"SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"Term 2
\n
"
);
(
yyval
)
=
(
yyvsp
[
0
]);
}
#line 1
663
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
#line 1
726
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
45
:
#line 2
5
8 "SQLPGrammar_new.y"
/* yacc.c:1646 */
#line 28
6
"SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"INTEGER is |%s|"
,
yytext
);
(
yyval
)
=
create_constant
(
yytext
);
}
#line 1
672
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
#line 1
735
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
46
:
#line 2
63
"SQLPGrammar_new.y"
/* yacc.c:1646 */
#line 2
91
"SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"REAL is |%s|"
,
yytext
);
(
yyval
)
=
create_constant
(
yytext
);
}
#line 1
681
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
#line 1
744
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
case
47
:
#line 26
8
"SQLPGrammar_new.y"
/* yacc.c:1646 */
#line 2
9
6 "SQLPGrammar_new.y"
/* yacc.c:1646 */
{
printf
(
"STRING is |%s|"
,
yytext
);
(
yyval
)
=
create_constant
(
yytext
);
}
#line 1
690
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
#line 1
753
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
break
;
#line 1
694
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
#line 1
757
"SQLPGrammar_new.tab.c"
/* yacc.c:1646 */
default:
break
;
}
/* User semantic actions sometimes alter yychar, and that requires
...
...
This diff is collapsed.
Click to expand it.
SQLPGrammar_new.y
+
28
−
0
View file @
d00a16cc
...
...
@@ -57,15 +57,43 @@ Query
SelectQuery
: SELECT Body
{
printf("SelectQuery 1 \n");
$$ = $2;
}
| SELECT SelectList Body
{
printf("SelectQuery 2 \n");
$$ = create_proj_operator($2, $3);
}
| SELECT DISTINCT Body
{
printf("SelectList 3 \n");
$$ = $3;
}
| SELECT DISTINCT SelectList Body
{
printf("SelectList 4 \n");
$$ = create_proj_operator($2, $3);
}
;
Body
: FROM TableList
{
printf("Body 1 \n");
$$ = $2;
}
| FROM WHERE Pred
{
printf("Body 2 \n");
// todo
}
| FROM TableList WHERE Pred
{
printf("Body 3 \n");
$$ = create_eval_operator($4, $2);
}
;
TableList
...
...
This diff is collapsed.
Click to expand it.
SQLPParser_new
+
0
−
0
View file @
d00a16cc
No preview for this file type
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment