-
Notifications
You must be signed in to change notification settings - Fork 153
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
Fix performance in new aggregations #6006
Conversation
|
da156e7
to
1c9bbf3
Compare
1c9bbf3
to
9600435
Compare
@@ -139,7 +139,8 @@ export class ConnectionReadOperation extends Operation { | |||
} | |||
|
|||
public transpile(context: QueryASTContext): OperationTranspileResult { | |||
if (!context.target) throw new Error(); | |||
const contextTarget = context.target; | |||
if (!contextTarget) throw new Error(); |
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.
if (!contextTarget) throw new Error(); | |
if (!contextTarget.hasTarget()) throw new Error(); |
@@ -51,7 +51,7 @@ export class CountField extends AggregationField { | |||
} | |||
|
|||
public getAggregationExpr(variable: Cypher.Variable): Cypher.Expr { | |||
return Cypher.count(variable); | |||
return Cypher.count(variable).distinct(); |
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.
Can you add this in a separate PR?
return Cypher.count(variable).distinct(); | |
return Cypher.count(variable).distinct(); |
@@ -163,7 +164,18 @@ export class ConnectionReadOperation extends Operation { | |||
|
|||
const filtersSubqueries = [...authFilterSubqueries, ...normalFilterSubqueries]; | |||
|
|||
const aggregationSubqueries = this.aggregationField?.getSubqueries(context) ?? []; | |||
// Only add the import if it is nested | |||
const isTopLevel = !this.relationship; |
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.
Nitpick: considering the use case of this variable instead assign a variable from a negation and then negate the same variable again I will suggest to convert the variable name to isNested
and remove all the negations.
@@ -7,7 +7,40 @@ query TopLevelAggregate { | |||
} | |||
} | |||
|
|||
query TopLevelAggregateWithMultipleFields { | |||
query TopLevelAggregateWithMultipleFields_only { |
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.
focus test
} | ||
} | ||
|
||
query TopLevelAggregateWithMultipleFieldsDeprecated_only { |
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.
Focus test
Description
This PR fixes the performance (and potential bug) on new aggregations due to a missing
WITH this