Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Optimizer] Optimize variable-length edge predicate execution #5441

Closed
czpmango opened this issue Mar 27, 2023 · 3 comments
Closed

[Optimizer] Optimize variable-length edge predicate execution #5441

czpmango opened this issue Mar 27, 2023 · 3 comments
Assignees
Labels
type/enhancement Type: make the code neat or more efficient
Milestone

Comments

@czpmango
Copy link
Contributor

czpmango commented Mar 27, 2023

Introduction
Cypher provides predicate functions to filter all variable-length edges, and the statement is like:

MATCH (v:player)-[e:like*2..5]->(n)
WHERE all(i in e where i.likeness > 90)
RETURN n

There is room for optimization in the current implementation of nebula, and we can consider embedding the filter expression into the traverse operator, optimized plan is like this:
Scan -> Traverse(allEdgeFilter_ = e.likeness>90) -> Project

Contents
Add related optimization rules to gain performance benefits.

Related work
Some query semantics that are difficult to express in go statements can be replaced by match statement.

@czpmango czpmango added the type/enhancement Type: make the code neat or more efficient label Mar 27, 2023
@wey-gu
Copy link
Contributor

wey-gu commented Mar 28, 2023

It's exciting to see we started to optimize towards functions that used to be always evaluated after data fetching!

@Sophie-Xie
Copy link
Contributor

Sophie-Xie commented Apr 10, 2023

#5464
#5470
#5481
#5503

@czpmango
Copy link
Contributor Author

Only the basic edge all predicate pushdown is supported(predicate is a first-level attribute expression), such as:

MATCH (v)-[e*2..5]-(n) where all(i in e where i.prop1 >3 and i.prop2<4) RETURN *

Unsupported list:

  1. function predicate like
MATCH (v)-[e*2..5]-(n) where all(i in e where properties(i).prop1 >3 and rank(i).prop2<4) RETURN *
  1. double-not expression
MATCH (v)-[e*2..5]-(n) where all(i in e where !!(i.prop1 >3) and i.prop2<4) and not not all(i in e where i.prop>4) RETURN *
  1. ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement Type: make the code neat or more efficient
Projects
None yet
Development

No branches or pull requests

3 participants