This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git
The following commit(s) were added to refs/heads/master by this push:
new a1c1cd21a Minor: use DataType::is_nested (#3995)
a1c1cd21a is described below
commit a1c1cd21a27c9f3faae6a59f23feeb99c63fa134
Author: Andrew Lamb <[email protected]>
AuthorDate: Mon Oct 31 10:52:52 2022 -0400
Minor: use DataType::is_nested (#3995)
---
.../core/src/physical_plan/file_format/row_filter.rs | 18 ++----------------
1 file changed, 2 insertions(+), 16 deletions(-)
diff --git a/datafusion/core/src/physical_plan/file_format/row_filter.rs
b/datafusion/core/src/physical_plan/file_format/row_filter.rs
index 54bf4bb8f..5d953d3ae 100644
--- a/datafusion/core/src/physical_plan/file_format/row_filter.rs
+++ b/datafusion/core/src/physical_plan/file_format/row_filter.rs
@@ -16,7 +16,7 @@
// under the License.
use arrow::array::{Array, BooleanArray};
-use arrow::datatypes::{DataType, Field, Schema};
+use arrow::datatypes::{DataType, Schema};
use arrow::error::{ArrowError, Result as ArrowResult};
use arrow::record_batch::RecordBatch;
use datafusion_common::{Column, DataFusionError, Result, ScalarValue,
ToDFSchema};
@@ -244,7 +244,7 @@ impl<'a> ExprRewriter for FilterCandidateBuilder<'a> {
if let Ok(idx) = self.file_schema.index_of(&column.name) {
self.required_column_indices.push(idx);
- if !is_primitive_field(self.file_schema.field(idx)) {
+ if
DataType::is_nested(self.file_schema.field(idx).data_type()) {
self.non_primitive_columns = true;
}
} else if self.table_schema.index_of(&column.name).is_err() {
@@ -380,20 +380,6 @@ pub fn build_row_filter(
}
}
-/// return true if this is a non nested type.
-// TODO remove after https://github.com/apache/arrow-rs/issues/2704 is done
-fn is_primitive_field(field: &Field) -> bool {
- !matches!(
- field.data_type(),
- DataType::List(_)
- | DataType::FixedSizeList(_, _)
- | DataType::LargeList(_)
- | DataType::Struct(_)
- | DataType::Union(_, _, _)
- | DataType::Map(_, _)
- )
-}
-
#[cfg(test)]
mod test {
use crate::physical_plan::file_format::row_filter::FilterCandidateBuilder;