The following query (from the HotCRP open source software) fails to build a physical plan:
DataFusion error: This feature is not implemented: Physical plan does not support logical expression Exists(Exists { subquery: <subquery>, negated: false })
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
Subquery:
Aggregate: groupBy=[[]], aggr=[[group_concat(CAST(PaperConflict.paperId AS Utf8), Utf8(" "), CAST(PaperConflict.conflictType AS Utf8))]]
TableScan: PaperConflict projection=[paperId, conflictType], full_filters=[PaperConflict.contactId = Int32(1)]
Subquery:
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)]
Subquery:
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)]
EmptyRelation: rows=1
Projection: EXISTS (<subquery>) AS EXISTS (SELECT paperId FROM PaperReview)
Subquery:
TableScan: PaperReview projection=[paperId]
EmptyRelation: rows=1
Describe the bug
The following query (from the HotCRP open source software) fails to build a physical plan:
The error is
The reason is that some queries have subqueries in their projection, but the
decorrelate_predicate_subqueryoptimizer step only accepts filter plans.To Reproduce
A smaller query is:
Expected behavior
No response
Additional context
Logical plan:
Plan for the smaller minimal example query: