tustvold commented on code in PR #7432:
URL: https://github.com/apache/arrow-datafusion/pull/7432#discussion_r1325042739
##########
datafusion/physical-plan/src/lib.rs:
##########
@@ -242,45 +242,6 @@ pub fn with_new_children_if_necessary(
/// Return a [wrapper](DisplayableExecutionPlan) around an
/// [`ExecutionPlan`] which can be displayed in various easier to
/// understand ways.
-///
-/// ```
-/// use datafusion::prelude::*;
Review Comment:
I'm guessing this has been removed because the frontend is not a dependency
of physical-plan. Perhaps we could manually construct the physical plan? Don't
feel strongly
##########
datafusion/physical-plan/src/repartition/mod.rs:
##########
@@ -1414,4 +1398,23 @@ mod tests {
Ok(())
}
+
+ /// Create vector batches
+ fn create_vec_batches(schema: &Schema, n: usize) -> Vec<RecordBatch> {
+ let batch = create_batch(schema);
+ let mut vec = Vec::with_capacity(n);
+ for _ in 0..n {
+ vec.push(batch.clone());
+ }
+ vec
Review Comment:
```suggestion
(0..n).map(|_| batch.clone()).collect()
```
And in the various copies of this function. It might even be sufficiently
concise to obviate the need for duplicating the function
##########
datafusion/physical-plan/src/test.rs:
##########
@@ -0,0 +1,343 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! Utilities for testing datafusion-physical-plan
+
+use std::error::Error;
+use std::pin::Pin;
+use std::sync::Arc;
+use std::{collections::HashMap, path::PathBuf};
+
+use arrow_array::{ArrayRef, Int32Array, RecordBatch};
+use arrow_schema::{DataType, Field, Schema, SchemaRef};
+use futures::{Future, FutureExt};
+
+use crate::memory::MemoryExec;
+use crate::ExecutionPlan;
+
+pub mod exec;
+
+/// A macro to assert that one string is contained within another with
Review Comment:
These functions appear to now be duplicated?
Perhaps some of these could be moved to datafusion-common::test_util?
Perhaps with a `#[doc(hidden)]` if we want to hide them from the public API
##########
datafusion/physical-plan/src/repartition/mod.rs:
##########
@@ -1414,4 +1398,23 @@ mod tests {
Ok(())
}
+
+ /// Create vector batches
+ fn create_vec_batches(schema: &Schema, n: usize) -> Vec<RecordBatch> {
+ let batch = create_batch(schema);
+ let mut vec = Vec::with_capacity(n);
+ for _ in 0..n {
+ vec.push(batch.clone());
+ }
+ vec
+ }
+
+ /// Create batch
+ fn create_batch(schema: &Schema) -> RecordBatch {
Review Comment:
This is a rather strange function, it takes a schema, but then proceeds to
assume the schema...
--
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]