Package io.delta.kernel.internal.util
Interface SchemaIterable.SchemaElement
- All Known Subinterfaces:
SchemaIterable.MutableSchemaElement
- Enclosing class:
SchemaIterable
public static interface SchemaIterable.SchemaElement
Interface for representing a schema element as part of a traversal.
This object should always be treated ephemeral and not be referenced once next() is
called on the iterator.
-
Method Summary
Modifier and TypeMethodDescriptiongetField()Get the current field.Returns the path to the node via user facing names.Returns the nearest ancestor that is a member of a StructType (could be the current element).Returns the nearest parent StructField (is a member of a StructType) if it exists.Returns the path to this node from the nearest ancestor that is a member of a StructType.default booleanReturns true if this element is a StructField (as compared to an array element or a map key/value).
-
Method Details
-
getField
StructField getField()Get the current field. -
getParentStructFieldAndPath
Optional<SchemaIterable.ParentStructFieldInfo> getParentStructFieldAndPath()Returns the nearest parent StructField (is a member of a StructType) if it exists. For an element that is at the root-level of the schema, this returns Optional.empty().Also returns the path from the nearest parent StructField. If the nearest parent StructField is a direct ancestor, this is "". Otherwise, the path is of the format
((key|value|element).)*(key|value|element) -
getNamePath
String getNamePath()Returns the path to the node via user facing names. -
getNearestStructFieldAncestor
StructField getNearestStructFieldAncestor()Returns the nearest ancestor that is a member of a StructType (could be the current element).Maps Keys and Values and Array elements are skipped over when finding the nearest ancestor.
-
getPathFromNearestStructFieldAncestor
Returns the path to this node from the nearest ancestor that is a member of a StructType.Prefix is prepend to any path with an added "."
If this element is a StructField returns prefix
Otherwise the grammar of the returned field is:
[<prefix>.]((key|value|element).)*(key|value|element) -
isStructField
default boolean isStructField()Returns true if this element is a StructField (as compared to an array element or a map key/value).
-