Class SubstraitRelUtils
- java.lang.Object
-
- com.amazonaws.athena.connector.substrait.SubstraitRelUtils
-
public final class SubstraitRelUtils extends Object
Utility class for working with Substrait relational algebra expressions. Provides methods to traverse and extract specific relation types from Substrait plans.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static io.substrait.proto.Plan
deserializeSubstraitPlan(String planString)
Deserializes a Base64-encoded Substrait plan into a Plan object.static io.substrait.proto.FetchRel
getFetchRel(io.substrait.proto.Rel rel)
Extracts a FetchRel (LIMIT operation) from a Substrait relation tree.static io.substrait.proto.FilterRel
getFilterRel(io.substrait.proto.Rel rel)
Extracts a FilterRel from a Substrait relation tree.static io.substrait.proto.ProjectRel
getProjectRel(io.substrait.proto.Rel rel)
Extracts a ProjectRel (SELECT operation) from a Substrait relation tree.static io.substrait.proto.ReadRel
getReadRel(io.substrait.proto.Rel rel)
Extracts a ReadRel (table scan operation) from a Substrait relation tree.static io.substrait.proto.SortRel
getSortRel(io.substrait.proto.Rel rel)
Extracts a SortRel (ORDER BY operation) from a Substrait relation tree.
-
-
-
Method Detail
-
getFilterRel
public static io.substrait.proto.FilterRel getFilterRel(io.substrait.proto.Rel rel)
Extracts a FilterRel from a Substrait relation tree.- Parameters:
rel
- The root relation to search from- Returns:
- The first FilterRel found in the relation tree, or null if none exists
-
getFetchRel
public static io.substrait.proto.FetchRel getFetchRel(io.substrait.proto.Rel rel)
Extracts a FetchRel (LIMIT operation) from a Substrait relation tree.- Parameters:
rel
- The root relation to search from- Returns:
- The first FetchRel found in the relation tree, or null if none exists
-
getSortRel
public static io.substrait.proto.SortRel getSortRel(io.substrait.proto.Rel rel)
Extracts a SortRel (ORDER BY operation) from a Substrait relation tree.- Parameters:
rel
- The root relation to search from- Returns:
- The first SortRel found in the relation tree, or null if none exists
-
getReadRel
public static io.substrait.proto.ReadRel getReadRel(io.substrait.proto.Rel rel)
Extracts a ReadRel (table scan operation) from a Substrait relation tree.- Parameters:
rel
- The root relation to search from- Returns:
- The first ReadRel found in the relation tree, or null if none exists
-
getProjectRel
public static io.substrait.proto.ProjectRel getProjectRel(io.substrait.proto.Rel rel)
Extracts a ProjectRel (SELECT operation) from a Substrait relation tree.- Parameters:
rel
- The root relation to search from- Returns:
- The first ProjectRel found in the relation tree, or null if none exists
-
deserializeSubstraitPlan
public static io.substrait.proto.Plan deserializeSubstraitPlan(String planString)
Deserializes a Base64-encoded Substrait plan into a Plan object.- Parameters:
planString
- Base64-encoded string representation of a Substrait plan- Returns:
- The deserialized Plan object
- Throws:
RuntimeException
- if the plan string cannot be decoded or parsed
-
-