alamb commented on code in PR #9795:
URL: https://github.com/apache/arrow-datafusion/pull/9795#discussion_r1540405151


##########
datafusion/expr/src/logical_plan/builder.rs:
##########
@@ -132,14 +132,26 @@ impl LogicalPlanBuilder {
     ) -> Result<Self> {
         // TODO: we need to do a bunch of validation here. Maybe more.
         if is_distinct {
-            return Err(DataFusionError::NotImplemented(
-                "Recursive queries with a distinct 'UNION' (in which the 
previous iteration's results will be de-duplicated) is not 
supported".to_string(),
-            ));
+            return not_impl_err!(
+                "Recursive queries with a distinct 'UNION' (in which the 
previous iteration's results will be de-duplicated) is not supported"
+            );
+        }
+        // Ensure that the static term and the recursive term have the same 
number of fields
+        let static_fields_len = self.plan.schema().fields().len();
+        let recurive_fields_len = recursive_term.schema().fields().len();
+        if static_fields_len != recurive_fields_len {
+            return plan_err!(
+                "Non-recursive term and recursive term must have the same 
number of columns ({} != {})",
+                static_fields_len, recurive_fields_len
+            );
         }
+        // Ensure that the recursive term has the same field types as the 
static term

Review Comment:
   Given the tests all pass this seems like a good plan to me. 



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

Reply via email to