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
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
Grant Weddell
LDI
Commits
faff81ba
Commit
faff81ba
authored
6 years ago
by
expan
Browse files
Options
Downloads
Patches
Plain Diff
Added code for cross, proj, and not
parent
d28369c0
No related branches found
No related tags found
1 merge request
!1
SQLP parser with cons cells
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
util.c
+36
-0
36 additions, 0 deletions
util.c
with
36 additions
and
0 deletions
util.c
+
36
−
0
View file @
faff81ba
...
@@ -59,6 +59,42 @@ cons_cell* create_union_operator(cons_cell* ra1, cons_cell* ra2) {
...
@@ -59,6 +59,42 @@ cons_cell* create_union_operator(cons_cell* ra1, cons_cell* ra2) {
return
operator_cons
;
return
operator_cons
;
}
}
cons_cell
*
create_cross_operator
(
cons_cell
*
ra1
,
cons_cell
*
ra2
)
{
cons_cell
*
ra2_cons
=
create_cons_cell
(
ra2
,
NULL
);
cons_cell
*
ra1_cons
=
create_cons_cell
(
ra1
,
ra2_cons
);
char
operator
[
5
]
=
"CROSS"
;
cons_cell
*
operator_cons
=
create_cons_cell_w_atom
(
operator
,
ra1_cons
);
return
operator_cons
;
}
// For when you want to assign column names to another name
cons_cell
*
create_assign_operator
(
char
*
col1
,
char
*
col2
)
{
cons_cell
*
col2_cons
=
create_cons_cell_w_atom
(
col2
,
NULL
);
cons_cell
*
col1_cons
=
create_cons_cell_w_atom
(
col1
,
col2_cons
);
char
operator
[
2
]
=
"AS"
;
cons_cell
*
operator_cons
=
create_cons_cell_w_atom
(
operator
,
col1_cons
);
return
operator_cons
;
}
cons_cell
*
create_proj_operator
(
cons_cell
*
assign1
,
cons_cell
*
assign2
,
cons_cell
*
ra
)
{
cons_cell
*
ra_cons
=
create_cons_cell
(
ra
,
NULL
);
cons_cell
*
assign2_cons
=
create_cons_cell
(
assign2
,
NULL
);
cons_cell
*
assign1_cons
=
create_cons_cell
(
assign1
,
assign2_cons
);
cons_cell
*
assign_cons
=
create_cons_cell
(
assign1_cons
,
ra_cons
);
char
operator
[
4
]
=
"PROJ"
;
cons_cell
*
operator_cons
=
create_cons_cell_w_atom
(
operator
,
assign_cons
);
return
operator_cons
;
}
cons_cell
*
create_not_operator
(
cons_cell
*
ra1
,
cons_cell
*
ra2
)
{
cons_cell
*
ra2_cons
=
create_cons_cell
(
ra2
,
NULL
);
cons_cell
*
ra1_cons
=
create_cons_cell
(
ra1
,
ra2_cons
);
char
operator
[
3
]
=
"NOT"
;
cons_cell
*
operator_cons
=
create_cons_cell_w_atom
(
operator
,
ra1_cons
);
return
operator_cons
;
}
const
char
*
node_types
[]
=
{
"program"
,
"id"
,
"query"
,
"select_query"
,
"body"
,
"table path"
,
"union_query"
,
const
char
*
node_types
[]
=
{
"program"
,
"id"
,
"query"
,
"select_query"
,
"body"
,
"table path"
,
"union_query"
,
"select list"
,
"attrpath"
,
"operator"
,
"bool"
,
"pred"
};
"select list"
,
"attrpath"
,
"operator"
,
"bool"
,
"pred"
};
...
...
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