zyuiop opened a new issue, #23022:
URL: https://github.com/apache/datafusion/issues/23022
### Describe the bug
The following query (from the HotCRP open source software) fails to build a
physical plan:
```
select (select group_concat(paperId, ' ', conflictType) from PaperConflict
where contactId=1), exists (select * from PaperReview where contactId=1 and
reviewType>0), exists (select * from PaperReview where requestedBy=1 and
reviewType>0 and reviewType<=2 and contactId!=1), 0
```
The error is
```
DataFusion error: This feature is not implemented: Physical plan does not
support logical expression Exists(Exists { subquery: <subquery>, negated: false
})
```
The reason is that some optimizer steps put subqueries in projections, but
the `decorrelate_predicate_subquery` optimizer step only accepts filter plans.
### To Reproduce
_No response_
### Expected behavior
_No response_
### Additional context
Logical plan:
```
Logical plan: Projection: (<subquery>), EXISTS (<subquery>) AS EXISTS
(SELECT * FROM PaperReview WHERE contactId = 1 AND reviewType > 0), EXISTS
(<subquery>) AS EXISTS (SELECT * FROM PaperReview WHERE requestedBy = 1 AND
reviewType > 0 AND reviewType <= 2 AND contactId <> 1), Int64(0) AS 0
proxy-hotcrp-1 | Subquery:
proxy-hotcrp-1 | Aggregate: groupBy=[[]],
aggr=[[group_concat(CAST(PaperConflict.paperId AS Utf8), Utf8(" "),
CAST(PaperConflict.conflictType AS Utf8))]]
proxy-hotcrp-1 | TableScan: PaperConflict
projection=[paperId, conflictType], full_filters=[PaperConflict.contactId =
Int32(1)]
proxy-hotcrp-1 | Subquery:
proxy-hotcrp-1 | TableScan: PaperReview
projection=[paperId, reviewId, contactId, reviewType, requestedBy, reviewToken,
reviewRound, reviewOrdinal, reviewBlind, reviewTime, reviewModified,
reviewSubmitted, reviewAuthorSeen, timeDisplayed, timeApprovalRequested,
reviewNeedsSubmit, reviewViewScore, rflags, timeRequested, timeRequestNotified,
reviewAuthorModified, reviewNotified, reviewAuthorNotified, reviewEditVersion,
reviewWordCount, s01, s02, s03, s04, s05, s06, s07, s08, s09, s10, s11,
tfields, sfields], full_filters=[PaperReview.contactId = Int32(1),
PaperReview.reviewType > Int8(0)]
proxy-hotcrp-1 | Subquery:
proxy-hotcrp-1 | TableScan: PaperReview
projection=[paperId, reviewId, contactId, reviewType, requestedBy, reviewToken,
reviewRound, reviewOrdinal, reviewBlind, reviewTime, reviewModified,
reviewSubmitted, reviewAuthorSeen, timeDisplayed, timeApprovalRequested,
reviewNeedsSubmit, reviewViewScore, rflags, timeRequested, timeRequestNotified,
reviewAuthorModified, reviewNotified, reviewAuthorNotified, reviewEditVersion,
reviewWordCount, s01, s02, s03, s04, s05, s06, s07, s08, s09, s10, s11,
tfields, sfields], full_filters=[PaperReview.requestedBy = Int32(1),
PaperReview.reviewType > Int8(0), PaperReview.reviewType <= Int8(2),
PaperReview.contactId != Int32(1)]
proxy-hotcrp-1 | EmptyRelation: rows=1
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]