-
Notifications
You must be signed in to change notification settings - Fork 81
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
Add id(a) support to front-end #131
Conversation
@@ -1,45 +1,36 @@ | |||
#pragma once | |||
|
|||
#include <string> | |||
#include <utility> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this include
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -1,31 +1,30 @@ | |||
#pragma once | |||
|
|||
#include <string> | |||
#include <utility> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
}; | ||
|
||
const string DataTypeNames[] = { | ||
"REL", "NODE", "LABEL", "BOOL", "INT32", "INT64", "DOUBLE", "STRING", "UNKNOWN"}; | ||
"REL", "NODE", "LABEL", "BOOL", "INT32", "INT64", "DOUBLE", "STRING", "NODE_ID", "UNKNOWN"}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"UNSTRUCTURED"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simple PR to understand, just change the terminology used.
Let's add end-to-end tests that use the id() comparison operations as part of this PR.
@@ -15,6 +15,12 @@ class LogicalRelExpression : public LogicalExpression { | |||
|
|||
inline string getDstNodeName() const { return dstNode->name; } | |||
|
|||
inline bool isSelfLoopRel() const { return srcNode->name == dstNode->name; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is selfLoop part of adding id() comparison support?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because selfLoop edge is rewrite as a regular edge with an ID equal filter (which is also an ID comparison)
@@ -17,9 +17,9 @@ LogicalExpression::LogicalExpression( | |||
} | |||
|
|||
LogicalExpression::LogicalExpression( | |||
ExpressionType expressionType, DataType dataType, const string& variableName) | |||
ExpressionType expressionType, DataType dataType, const string& propertyOrFunctionName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only function name allowed here is id()?
src/planner/binder.cpp
Outdated
if (FUNCTION == expression->expressionType && COUNT_STAR == expression->variableName && | ||
1 != expressions.size()) { | ||
if (FUNCTION == expression->expressionType && | ||
FUNCTION_COUNT_STAR == expression->propertyOrFunctionName && 1 != expressions.size()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flip the !=
expressions.size() != 1 reads better.
@@ -299,18 +307,18 @@ void Enumerator::appendNecessaryScans(shared_ptr<LogicalExpression> expression, | |||
void Enumerator::appendScanNodeProperty( | |||
const string& nodeName, const string& propertyName, LogicalPlan& plan) { | |||
auto queryNode = mergedQueryGraph->getQueryNode(nodeName); | |||
auto scanProperty = make_shared<LogicalScanNodeProperty>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use queryNode->name for consistency.
label_t boundNodeVarLabel; | ||
string nbrNodeVarName; | ||
label_t nbrNodeVarLabel; | ||
string boundNodeIDPropertyName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
boundAttributeName where attribute is ID or property works. (otherwise add or in the name).
If you use the term attribute then use it everywhere where you refer to NodeIDPropertyname.
This terminology is used in existing scan and read operators. We have a ScanAttribute operator shared by ScanNodeID, ScanStructuredProperty, and ScanUnstructuredProperty. So you won't be introducing the term attribute.
070f693
to
1efbfc1
Compare
This PR add node id comparison support for front-end and should solve issue #102 and issue #127
Example
MATCH (a)->(b) WHERE id(a) = id(b) RETURN *
id(a)
binds to a logical property expressiona._id
a
toa._id
(a)->(a)
as(a)->(anonymou) WHERE a._id = anonymous._id