You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "martin-g (via GitHub)" <gi...@apache.org> on 2025/11/30 14:40:13 UTC

Re: [PR] fix: CteWorkTable: properly apply TableProvider::scan projection argument [datafusion]

martin-g commented on code in PR #18993:
URL: https://github.com/apache/datafusion/pull/18993#discussion_r2573766569


##########
datafusion/catalog/src/cte_worktable.rs:
##########
@@ -86,15 +87,20 @@ impl TableProvider for CteWorkTable {
     async fn scan(
         &self,
         _state: &dyn Session,
-        _projection: Option<&Vec<usize>>,
-        _filters: &[Expr],
-        _limit: Option<usize>,
+        projection: Option<&Vec<usize>>,
+        filters: &[Expr],
+        limit: Option<usize>,
     ) -> Result<Arc<dyn ExecutionPlan>> {
-        // TODO: pushdown filters and limits
+        assert_or_internal_err!(
+            filters.is_empty(),
+            "CteWorkTable does not support pushing filters"
+        );
+        assert_or_internal_err!(limit.is_none(), "CteWorkTable pushing limit");

Review Comment:
   The error message is a bit unclear to me.
   Maybe:
   
   ```suggestion
           assert_or_internal_err!(limit.is_none(), "CteWorkTable does not support limit pushdown");
   ```
   ?!



##########
datafusion/physical-plan/src/work_table.rs:
##########


Review Comment:
   It would be good to add a test case using projection.



##########
datafusion/physical-plan/src/work_table.rs:
##########
@@ -103,25 +103,35 @@ pub struct WorkTableExec {
     name: String,
     /// The schema of the stream
     schema: SchemaRef,
+    /// Projection to apply to build the output stream from the recursion state
+    projection: Option<Vec<usize>>,
     /// The work table
     work_table: Arc<WorkTable>,
     /// Execution metrics
     metrics: ExecutionPlanMetricsSet,
     /// Cache holding plan properties like equivalences, output partitioning etc.

Review Comment:
   The docstring is outdated now. The field is not named `cache` anymore.



-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org