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 class
Create a distribution on columns. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
AUTO indicates that the number of buckets is automatically determined by the system (without the need for manual specification).static final Distribution
List bucketing strategy hash, TODO: #1505 Separate the bucket number from the Distribution.static final Distribution
NONE is used to indicate that there is no distribution.static final Distribution
List bucketing strategy range, TODO: #1505 Separate the bucket number from the Distribution. -
Method Summary
Modifier and TypeMethodDescriptionstatic Distribution
auto
(Strategy strategy, Expression... expressions) Create a distribution by the given strategy, the number of buckets is not used.static Distribution
even
(int number, Expression... expressions) Create a distribution by evenly distributing the data across the number of buckets.static Distribution
Create a distribution on columns.static Distribution
hash
(int number, Expression... expressions) Create a distribution by hashing the data across the number of buckets.static Distribution
of
(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.Builder
to 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.
-