You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2025/08/18 12:47:54 UTC

Re: [PR] fix: deserialization error for inlist [datafusion]

alamb commented on code in PR #17224:
URL: https://github.com/apache/datafusion/pull/17224#discussion_r2282295377


##########
datafusion/proto/src/physical_plan/mod.rs:
##########
@@ -567,43 +567,33 @@ impl protobuf::PhysicalPlanNode {
     ) -> Result<Arc<dyn ExecutionPlan>> {
         let input: Arc<dyn ExecutionPlan> =
             into_physical_plan(&filter.input, ctx, runtime, extension_codec)?;
-        let projection = if !filter.projection.is_empty() {
-            Some(
-                filter
-                    .projection
-                    .iter()
-                    .map(|i| *i as usize)
-                    .collect::<Vec<_>>(),
-            )
-        } else {
-            None
-        };
-
-        // Use the projected schema if projection is present, otherwise use the full schema
-        let predicate_schema = if let Some(ref proj_indices) = projection {
-            // Create projected schema for parsing the predicate
-            let projected_fields: Vec<_> = proj_indices
-                .iter()
-                .map(|&i| input.schema().field(i).clone())
-                .collect();
-            Arc::new(Schema::new(projected_fields))
-        } else {
-            input.schema()
-        };
 
         let predicate = filter
             .expr
             .as_ref()
             .map(|expr| {
-                parse_physical_expr(expr, ctx, predicate_schema.as_ref(), extension_codec)
+                parse_physical_expr(expr, ctx, input.schema().as_ref(), extension_codec)

Review Comment:
   Using the input schema always matches my understanding of how the FilterExec work 👍 



##########
datafusion/proto/tests/cases/roundtrip_physical_plan.rs:
##########
@@ -1909,3 +1909,37 @@ async fn test_round_trip_date_part_display() -> Result<()> {
 
     Ok(())
 }
+
+#[tokio::test]
+async fn test_tpch_part_in_list_query_with_real_parquet_data() -> Result<()> {

Review Comment:
   I verified this test covers the code as it fails without the fix
   
   ```
   
   
   ---- cases::roundtrip_physical_plan::test_tpch_part_in_list_query_with_real_parquet_data stdout ----
   Error: Internal("PhysicalExpr Column references column 'p_size' at index 1 (zero-based) but input schema only has 1 columns: [\"p_size\"]")
   ```



-- 
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