-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Change limit to expression. #2878
Conversation
|
||
Limit(QueryContext* qctx, PlanNode* input, int64_t offset, Expression* count) | ||
: SingleInputNode(qctx, Kind::kLimit, input) { | ||
offset_ = offset; | ||
count_ = count; | ||
} | ||
|
||
void cloneMembers(const Limit&); | ||
|
||
private: | ||
int64_t offset_{-1}; |
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.
Need change offset_
into an expression?
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.
offset won't push down
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.
It is better to ensure consistency in use.
go from ....| offset abs(1)+3 limit abs(3)+1
go from ....| limit abs(3)+1,abs(3)
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.
This is used for new syntax for go ... limit [..]
int64_t count() const { | ||
if (count_ == nullptr) { | ||
return -1; | ||
} | ||
DCHECK(ExpressionUtils::isEvaluableExpr(count_)); | ||
QueryExpressionContext ctx; | ||
return count_->eval(ctx).getInt(); | ||
} |
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.
Is this interface necessary?
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.
Compatible.
Subjob of #2602 |
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.
I don't know what this PR is for? could you give some description?
@@ -50,6 +50,10 @@ StatusOr<OptRule::TransformResult> LimitPushDownRule::transform( | |||
const auto proj = static_cast<const Project *>(projGroupNode->node()); | |||
const auto gn = static_cast<const GetNeighbors *>(gnGroupNode->node()); | |||
|
|||
DCHECK(graph::ExpressionUtils::isEvaluableExpr(limit->countExpr())); |
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.
Don't use DCHECK to debug your code if it's the regular branch you need to handle.
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.
This won't happen in correct state.
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.
So why did you do the same check in line 54?
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.
Handle exception scenes
Push down limit to GN in Loop for each step. |
Include in #2853 |
For the limit push down in Loop
Subjob of #2602