Support EXISTS subqueries in projection list#4168
Conversation
| final var underlyingValue = new ExistsValue(asExistential.getQuantifier().getAlias()); | ||
| getDelegate().getCurrentPlanFragment().addOperator(asExistential); | ||
| final var underlyingValue = new ExistsValue(QuantifiedObjectValue.of(asExistential.getQuantifier())); | ||
| if (getDelegate().getPlanGenerationContext().shouldProcessLiteral()) { |
There was a problem hiding this comment.
The plan generator is not designed to handle subqueries in projection list yet, which I think is what driving the condition to prevent plan generation twice of exists.
There should be a better way of doing this.
There was a problem hiding this comment.
Yes, the way it's done currently is definitely wasteful. The reason is that the selectElements are parsed twice - first, to know if there are aggregations, and again for constructing the QGM - this is what is driving the EXISTS to be explored. shouldProcessLiteral seems to be a flag for avoiding literal processing on the first go - and hence I borrow it here to avoid quantifier attachment to expression. Happy to talk about potential improvements!
7513412 to
308c043
Compare
📊 Metrics Diff Analysis ReportSummary
ℹ️ About this analysisThis automated analysis compares query planner metrics between the base branch and this PR. It categorizes changes into:
The last category in particular may indicate planner regressions that should be investigated. New QueriesCount of new queries by file:
Plan and Metrics ChangedThese queries experienced both plan and metrics changes. This generally indicates that there was some planner change Total: 4 queries Statistical Summary (Plan and Metrics Changed)
There were no queries with significant regressions detected. Minor Changes (Plan and Metrics Changed)In addition, there were 4 queries with minor changes. Only Metrics ChangedThese queries experienced only metrics changes without any plan changes. If these metrics have substantially changed, Total: 2 queries Statistical Summary (Only Metrics Changed)
Significant Regressions (Only Metrics Changed)There were 2 outliers detected. Outlier queries have a significant regression in at least one field. Statistically, this represents either an increase of more than two standard deviations above the mean or a large absolute increase (e.g., 100).
|
Summary
Test plan