Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
picodata
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
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
core
picodata
Commits
ba86c49f
Commit
ba86c49f
authored
3 years ago
by
Igor Kuznetsov
Browse files
Options
Downloads
Patches
Plain Diff
feat: add public methods for more usefully
parent
70056c8b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1414
sbroad import
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/ir.rs
+43
-7
43 additions, 7 deletions
src/ir.rs
with
43 additions
and
7 deletions
src/ir.rs
+
43
−
7
View file @
ba86c49f
...
...
@@ -2,6 +2,17 @@
//!
//! Contains the logical plan tree and helpers.
use
std
::
collections
::
HashMap
;
use
serde
::{
Deserialize
,
Serialize
};
use
expression
::
Expression
;
use
operator
::
Relational
;
use
relation
::
Table
;
use
crate
::
errors
::
QueryPlannerError
;
use
crate
::
ir
::
value
::
Value
;
pub
mod
distribution
;
pub
mod
expression
;
pub
mod
helpers
;
...
...
@@ -10,13 +21,6 @@ pub mod relation;
pub
mod
tree
;
pub
mod
value
;
use
crate
::
errors
::
QueryPlannerError
;
use
expression
::
Expression
;
use
operator
::
Relational
;
use
relation
::
Table
;
use
serde
::{
Deserialize
,
Serialize
};
use
std
::
collections
::
HashMap
;
/// Plan tree node.
///
/// There are two kinds of node variants: expressions and relational
...
...
@@ -178,6 +182,38 @@ impl Plan {
}
map
}
#[must_use]
pub
fn
next_id
(
&
self
)
->
usize
{
self
.nodes
.next_id
()
}
/// Add constant value to the plan.
pub
fn
add_const
(
&
mut
self
,
v
:
Value
)
->
usize
{
self
.nodes
.add_const
(
v
)
}
/// Add condition note to the plan.
///
/// # Errors
/// Returns `QueryPlannerError` when the condition node can't append'.
pub
fn
add_cond
(
&
mut
self
,
left
:
usize
,
op
:
operator
::
Bool
,
right
:
usize
,
)
->
Result
<
usize
,
QueryPlannerError
>
{
self
.nodes
.add_bool
(
left
,
op
,
right
)
}
/// Set top node of plan
/// # Errors
/// - top node doesn't exist in AST
pub
fn
set_top
(
&
mut
self
,
top
:
usize
)
->
Result
<
(),
QueryPlannerError
>
{
self
.get_node
(
top
)
?
;
self
.top
=
Some
(
top
);
Ok
(())
}
}
#[cfg(test)]
...
...
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