Skip to content

feat: Add IndexByName and IndexById to Namemapping #1299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
1 change: 1 addition & 0 deletions crates/iceberg/src/expr/visitors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub(crate) mod expression_evaluator;
pub(crate) mod inclusive_metrics_evaluator;
pub(crate) mod inclusive_projection;
pub(crate) mod manifest_evaluator;
pub(crate) mod name_mapping_visitor;
pub(crate) mod page_index_evaluator;
pub(crate) mod row_group_metrics_evaluator;
pub(crate) mod strict_metrics_evaluator;
Expand Down
35 changes: 35 additions & 0 deletions crates/iceberg/src/expr/visitors/name_mapping_visitor.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// 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.

use crate::spec::MappedField;

/// A trait for visiting and transforming a name mapping
pub trait NameMappingVisitor {
/// Aggregated result of `MappedField`s
type S;
/// Result type for processing one `MappedField`
type T;

/// Handles entire `NameMapping` field
fn mapping(&self, field_result: Self::S) -> Self::S;

/// Takes all visited child maps and merges into one map
fn fields(&self, field_results: Vec<Self::T>) -> Self::S;

/// Handles a single `MappedField`
fn field(&self, field: &MappedField, field_result: Self::S) -> Self::T;
}
Loading
Loading