Skip to content

Commit

Permalink
remove context
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinlanhenke committed Mar 20, 2024
1 parent 8c519eb commit c765268
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions crates/catalog/hms/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
// under the License.

use hive_metastore::FieldSchema;
use iceberg::spec::{visit_schema, NestedFieldRef, PrimitiveType, Schema, SchemaVisitor};
use iceberg::spec::{visit_schema, PrimitiveType, Schema, SchemaVisitor};
use iceberg::{Error, ErrorKind, Result};

type HiveSchema = Vec<FieldSchema>;

#[derive(Debug, Default)]
pub(crate) struct HiveSchemaBuilder {
schema: HiveSchema,
context: Vec<NestedFieldRef>,
depth: usize,
}

impl HiveSchemaBuilder {
Expand All @@ -42,7 +42,7 @@ impl HiveSchemaBuilder {

/// Check if is in `StructType` while traversing schema
fn is_inside_struct(&self) -> bool {
!self.context.is_empty()
self.depth > 0
}
}

Expand All @@ -59,9 +59,9 @@ impl SchemaVisitor for HiveSchemaBuilder {

fn before_struct_field(
&mut self,
field: &iceberg::spec::NestedFieldRef,
_field: &iceberg::spec::NestedFieldRef,
) -> iceberg::Result<()> {
self.context.push(field.clone());
self.depth += 1;
Ok(())
}

Expand All @@ -77,7 +77,7 @@ impl SchemaVisitor for HiveSchemaBuilder {
&mut self,
_field: &iceberg::spec::NestedFieldRef,
) -> iceberg::Result<()> {
self.context.pop();
self.depth -= 1;
Ok(())
}

Expand Down

0 comments on commit c765268

Please sign in to comment.