niebayes opened a new issue, #15224:
URL: https://github.com/apache/datafusion/issues/15224

   ### Describe the bug
   
   Say a Limit operator with skip 0 and fetch 5. 
   
   Calls `LogicalPlan::expressions` to get the expressions in the Limit 
operator, and then reconstructs it by feeding those expressions to 
`LogicalPlan::with_new_exprs`. The reconstructed Limit operator would be skip 5 
and fetch 0.
   
   Apparently, the expressions are out of order and the reconstructed Limit 
operator is not consistent with the original one.
   
   ### To Reproduce
   
   The following test would fail.
     
     #[test]
       fn test_reconstruct_limit() -> Result<()> {
           use datafusion_expr::lit;
           let limit = LogicalPlan::Limit(Limit {
               skip: Some(Box::new(lit(0))),
               fetch: Some(Box::new(lit(5))),
               input: Arc::new(LogicalPlan::EmptyRelation(EmptyRelation {
                   produce_one_row: false,
                   schema: Schema::empty().to_dfschema_ref()?,
               })),
           });
   
           let expr = limit.expressions();
           let new_limit = limit.with_new_exprs(
               expr,
               limit.inputs().into_iter().map(|x| x.clone()).collect(),
           )?;
   
           assert_eq!(limit, new_limit);
   
           Ok(())
       }
   
   ### Expected behavior
   
   _No response_
   
   ### Additional context
   
   _No response_


-- 
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-unsubscr...@datafusion.apache.org.apache.org

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


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

Reply via email to