Class FieldPath
Object
gudusoft.gsqlparser.resolver2.model.FieldPath
Represents a field path for deep/record field access in structured types.
In BigQuery, Snowflake, and other databases with STRUCT/RECORD types,
column references can include field paths like customer.address.city.
This class captures the field path portion (segments beyond the base column).
Design principles:
- Immutable - once created, cannot be modified
- Only stores segments beyond the base column (e.g., for
customer.address.city, if base column iscustomer, fieldPath stores["address", "city"]) - Empty fieldPath means no field access (regular column reference)
Example:
-- SQL: SELECT customer.address.city FROM orders -- base column: customer -- fieldPath: ["address", "city"]
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreate a new FieldPath with additional segments appended.Create a new FieldPath with an additional segment appended.booleanget(int index) Get a segment by index.getFirst()Get the first segment (immediate field).getLast()Get the last segment (deepest field).Get the field path segments.inthashCode()booleanisEmpty()Check if this field path is empty (no field access).static FieldPathCreate a FieldPath from a single segment.static FieldPathCreate a FieldPath from multiple segments.static FieldPathCreate a FieldPath from a list of segments.intsize()Get the number of segments in this field path.subPath(int fromIndex) Create a sub-path starting from the given index.toFullReference(String baseColumn) Convert to full reference string with base column.toString()Convert to dot-separated string representation.
-
Field Details
-
EMPTY
Empty field path singleton for regular column references
-
-
Constructor Details
-
FieldPath
Create a FieldPath from a list of segments.- Parameters:
segments- The field path segments (will be copied)
-
-
Method Details
-
of
Create a FieldPath from a single segment.- Parameters:
segment- The single field segment- Returns:
- A new FieldPath with one segment
-
of
Create a FieldPath from multiple segments.- Parameters:
segments- The field segments- Returns:
- A new FieldPath
-
of
Create a FieldPath from a list of segments.- Parameters:
segments- The field segments- Returns:
- A new FieldPath, or EMPTY if null/empty
-
getSegments
Get the field path segments.- Returns:
- Unmodifiable list of segments
-
size
Get the number of segments in this field path.- Returns:
- Number of segments
-
isEmpty
Check if this field path is empty (no field access).- Returns:
- true if empty
-
getFirst
Get the first segment (immediate field).- Returns:
- First segment, or null if empty
-
getLast
Get the last segment (deepest field).- Returns:
- Last segment, or null if empty
-
get
Get a segment by index.- Parameters:
index- The index- Returns:
- The segment at that index
- Throws:
IndexOutOfBoundsException- if index is invalid
-
append
Create a new FieldPath with an additional segment appended.- Parameters:
segment- The segment to append- Returns:
- New FieldPath with the segment appended
-
append
Create a new FieldPath with additional segments appended.- Parameters:
other- The FieldPath to append- Returns:
- New FieldPath with all segments
-
subPath
Create a sub-path starting from the given index.- Parameters:
fromIndex- Start index (inclusive)- Returns:
- New FieldPath with segments from fromIndex
-
toString
Convert to dot-separated string representation. -
toFullReference
Convert to full reference string with base column.- Parameters:
baseColumn- The base column name- Returns:
- String like "customer.address.city"
-
equals
-
hashCode
-