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


##########
datafusion/core/tests/physical_optimizer/limit_pushdown.rs:
##########
@@ -52,9 +52,18 @@ fn projection_exec(
 ) -> Result<Arc<dyn ExecutionPlan>> {
     Ok(Arc::new(ProjectionExec::try_new(
         vec![
-            (col("c1", schema.as_ref()).unwrap(), "c1".to_string()),
-            (col("c2", schema.as_ref()).unwrap(), "c2".to_string()),
-            (col("c3", schema.as_ref()).unwrap(), "c3".to_string()),
+            ProjectionExpr {

Review Comment:
   Going one step farther, I think we could make ProjectionExec generic, like 
this
   ```rust
   impl ProjectionExec {
       /// Create a projection on an input
       pub fn try_new(
           expr: impl IntoIterator<Item=ProjectionExpr>,
           input: Arc<dyn ExecutionPlan>,
       ) -> Result<Self> {
   ```
   
   That would let people use the same code mostly without change
   
   Update: I tried it out and it seems to work pretty well. Check out
   - https://github.com/pydantic/datafusion/pull/38#
   
   



##########
datafusion/core/tests/physical_optimizer/limit_pushdown.rs:
##########
@@ -52,9 +52,18 @@ fn projection_exec(
 ) -> Result<Arc<dyn ExecutionPlan>> {
     Ok(Arc::new(ProjectionExec::try_new(
         vec![
-            (col("c1", schema.as_ref()).unwrap(), "c1".to_string()),
-            (col("c2", schema.as_ref()).unwrap(), "c2".to_string()),
-            (col("c3", schema.as_ref()).unwrap(), "c3".to_string()),
+            ProjectionExpr {

Review Comment:
   We might be able to make the API change easier to handle by using a `From` 
impl:
   
   so like instead of
   
   ```rust
   vec![
    (col("c1", schema.as_ref()).unwrap(), "c1".to_string()),
   ]
   ```
   
   something like
   
   ```rust
   vec![
    ProjectionExpr::from(col("c1", schema.as_ref()).unwrap(), "c1".to_string()),
   ]
   ```
   
   This would mean that people upgrading could simply add `ProjectionExpr::from`



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

Reply via email to