Class Distributions
java.lang.Object
org.apache.gravitino.rel.expressions.distributions.Distributions
Helper methods to create distributions to pass into Apache Gravitino.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classCreate a distribution on columns. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intAUTO indicates that the number of buckets is automatically determined by the system (without the need for manual specification).static final DistributionList bucketing strategy hash, TODO: #1505 Separate the bucket number from the Distribution.static final DistributionNONE is used to indicate that there is no distribution.static final DistributionList bucketing strategy range, TODO: #1505 Separate the bucket number from the Distribution. -
Method Summary
Modifier and TypeMethodDescriptionstatic Distributionauto(Strategy strategy, Expression... expressions) Create a distribution by the given strategy, the number of buckets is not used.static Distributioneven(int number, Expression... expressions) Create a distribution by evenly distributing the data across the number of buckets.static DistributionCreate a distribution on columns.static Distributionhash(int number, Expression... expressions) Create a distribution by hashing the data across the number of buckets.static Distributionof(Strategy strategy, int number, Expression... expressions) Create a distribution by the given strategy.
-
Field Details
-
AUTO
public static final int AUTOAUTO indicates that the number of buckets is automatically determined by the system (without the need for manual specification).- See Also:
-
NONE
NONE is used to indicate that there is no distribution. -
HASH
List bucketing strategy hash, TODO: #1505 Separate the bucket number from the Distribution. -
RANGE
List bucketing strategy range, TODO: #1505 Separate the bucket number from the Distribution.
-
-
Method Details
-
even
Create a distribution by evenly distributing the data across the number of buckets.- Parameters:
number- The number of bucketsexpressions- The expressions to distribute by- Returns:
- The created even distribution
-
hash
Create a distribution by hashing the data across the number of buckets.- Parameters:
number- The number of bucketsexpressions- The expressions to distribute by- Returns:
- The created hash distribution
-
of
Create a distribution by the given strategy.- Parameters:
strategy- The strategy to usenumber- The number of bucketsexpressions- The expressions to distribute by- Returns:
- The created distribution
-
auto
Create a distribution by the given strategy, the number of buckets is not used.- Parameters:
strategy- The strategy to useexpressions- The expressions to distribute by- Returns:
- The created distribution
-
fields
Create a distribution on columns. Like distribute by (a) or (a, b), for complex like distributing by (func(a), b) or (func(a), func(b)), please useDistributions.DistributionImpl.Builderto create.NOTE: a, b, c are column names. SQL syntax: distribute by hash(a, b) buckets 5 fields(Strategy.HASH, 5, new String[]{"a"}, new String[]{"b"}); SQL syntax: distribute by hash(a, b, c) buckets 10 fields(Strategy.HASH, 10, new String[]{"a"}, new String[]{"b"}, new String[]{"c"}); SQL syntax: distribute by EVEN(a) buckets 128 fields(Strategy.EVEN, 128, new String[]{"a"});- Parameters:
strategy- The strategy to use.number- The number of buckets.fieldNames- The field names to distribute by.- Returns:
- The created distribution.
-