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
9795a228
Verified
Commit
9795a228
authored
2 years ago
by
Denis Smirnov
Browse files
Options
Downloads
Patches
Plain Diff
perf: reduce the amount of redundant hash sets for long rows
parent
ea49b325
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/expression.rs
+25
-7
25 additions, 7 deletions
src/ir/expression.rs
with
25 additions
and
7 deletions
src/ir/expression.rs
+
25
−
7
View file @
9795a228
...
@@ -630,16 +630,34 @@ impl Plan {
...
@@ -630,16 +630,34 @@ impl Plan {
)
->
Result
<
HashSet
<
usize
>
,
QueryPlannerError
>
{
)
->
Result
<
HashSet
<
usize
>
,
QueryPlannerError
>
{
let
mut
rel_nodes
:
HashSet
<
usize
>
=
HashSet
::
new
();
let
mut
rel_nodes
:
HashSet
<
usize
>
=
HashSet
::
new
();
if
let
Node
::
Expression
(
Expression
::
Row
{
..
})
=
self
.get_node
(
row_id
)
?
{
let
row
=
self
.get_expression_node
(
row_id
)
?
;
let
post_tree
=
DftPost
::
new
(
&
row_id
,
|
node
|
self
.nodes
.expr_iter
(
node
,
false
));
if
let
Expression
::
Row
{
..
}
=
row
{
for
(
_
,
node
)
in
post_tree
{
}
else
{
if
let
Node
::
Expression
(
Expression
::
Reference
{
..
})
=
self
.get_node
(
*
node
)
?
{
return
Err
(
QueryPlannerError
::
CustomError
(
"Node is not a row"
.into
()));
rel_nodes
.extend
(
&
self
.get_relational_from_reference_node
(
*
node
)
?
);
}
let
post_tree
=
DftPost
::
new
(
&
row_id
,
|
node
|
self
.nodes
.expr_iter
(
node
,
false
));
for
(
_
,
id
)
in
post_tree
{
let
reference
=
self
.get_expression_node
(
*
id
)
?
;
if
let
Expression
::
Reference
{
targets
,
parent
,
..
}
=
reference
{
let
referred_rel_id
=
parent
.ok_or
(
QueryPlannerError
::
CustomError
(
"Reference node has no parent"
.into
(),
))
?
;
let
rel
=
self
.get_relation_node
(
referred_rel_id
)
?
;
if
let
Some
(
children
)
=
rel
.children
()
{
if
let
Some
(
positions
)
=
targets
{
for
pos
in
positions
{
if
let
Some
(
child
)
=
children
.get
(
*
pos
)
{
rel_nodes
.insert
(
*
child
);
}
}
}
}
}
}
}
return
Ok
(
rel_nodes
);
}
}
Err
(
QueryPlannerError
::
InvalidRow
)
Ok
(
rel_nodes
)
}
}
/// Check that the node is a boolean equality and its children are both rows.
/// Check that the node is a boolean equality and its children are both rows.
...
...
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