Apache DataFusion SQL Query Engine
minor: simplify sqllogic test schema check (#5769)
comphead8e125d2ecf24
diff --git a/datafusion/core/tests/sqllogictests/src/engines/datafusion/normalize.rs b/datafusion/core/tests/sqllogictests/src/engines/datafusion/normalize.rsindex 5fad28f733..69b6c54c2f 100644--- a/datafusion/core/tests/sqllogictests/src/engines/datafusion/normalize.rs+++ b/datafusion/core/tests/sqllogictests/src/engines/datafusion/normalize.rs@@ -15,7 +15,6 @@// specific language governing permissions and limitations// under the License.-use arrow::datatypes::SchemaRef;use arrow::{array, array::ArrayRef, datatypes::DataType, record_batch::RecordBatch};use datafusion_common::DFField;use datafusion_common::DataFusionError;@@ -36,7 +35,7 @@ pub fn convert_batches(batches: Vec<RecordBatch>) -> Result<Vec<Vec<String>>> {let mut rows = vec![];for batch in batches {// Verify schema- if !equivalent_names_and_types(&schema, batch.schema()) {+ if !schema.contains(&batch.schema()) {return Err(DFSqlLogicTestError::DataFusion(DataFusionError::Internal(format!("Schema mismatch. Previously had\n{:#?}\n\nGot:\n{:#?}",@@ -144,18 +143,6 @@ lazy_static! {static ref WORKSPACE_ROOT: object_store::path::Path = workspace_root();}-/// Check two schemas for being equal for field names/types-fn equivalent_names_and_types(schema: &SchemaRef, other: SchemaRef) -> bool {- if schema.fields().len() != other.fields().len() {- return false;- }- let self_fields = schema.fields().iter();- let other_fields = other.fields().iter();- self_fields- .zip(other_fields)- .all(|(f1, f2)| f1.name() == f2.name() && f1.data_type() == f2.data_type())-}-/// Convert a single batch to a `Vec<Vec<String>>` for comparisonfn convert_batch(batch: RecordBatch) -> Result<Vec<Vec<String>>> {(0..batch.num_rows())