jonahgao commented on issue #13092:
URL: https://github.com/apache/datafusion/issues/13092#issuecomment-2436690476

   I think we can check if the number of columns is the same when 
[building](https://github.com/apache/datafusion/blob/232293367d6f3ff10e291597e1dc45bcce7de7d7/datafusion/expr/src/logical_plan/builder.rs#L1480)
 Unions, as it is a common scenario and does not depend on wildcard expansion 
and type coercion.
   
   ```rust
   pub fn union(left_plan: LogicalPlan, right_plan: LogicalPlan) -> 
Result<LogicalPlan> {
       if left_plan.schema().fields().len() != 
right_plan.schema().fields().len() {
           return plan_err!(
               "UNION queries have different number of columns: \
               left has {} columns whereas right has {} columns",
               left_plan.schema().fields().len(),
               right_plan.schema().fields().len()
           );
       }
   ```


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

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