com.datastrato.gravitino.rel.expressions.distributions.Strategy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of api Show documentation
Show all versions of api Show documentation
Gravitino is a high-performance, geo-distributed and federated metadata lake.
The newest version!
/*
* Copyright 2023 Datastrato Pvt Ltd.
* This software is licensed under the Apache License version 2.
*/
package com.datastrato.gravitino.rel.expressions.distributions;
import com.datastrato.gravitino.annotation.Evolving;
import java.util.Arrays;
/**
* An enum that defines the distribution strategy.
*
* The following strategies are supported:
*
*
* - Hash: Uses the hash value of the expression to distribute data.
*
- Range: Uses the range of the expression specified to distribute data.
*
- Even: Distributes data evenly across partitions.
*
*/
@Evolving
public enum Strategy {
/**
* No distribution strategy. This is the default strategy. Will depend on the allocation strategy
* of the underlying system.
*/
NONE,
/** Uses the hash value of the expression to distribute data. */
HASH,
/**
* Uses the range of the expression specified to distribute data. The range is specified using the
* rangeStart and rangeEnd properties.
*/
RANGE,
/** Distributes data evenly across partitions. */
EVEN;
/**
* Get the distribution strategy by name.
*
* @param name The name of the distribution strategy.
* @return The distribution strategy.
*/
public static Strategy getByName(String name) {
for (Strategy strategy : Strategy.values()) {
if (strategy.name().equalsIgnoreCase(name)) {
return strategy;
}
}
throw new IllegalArgumentException(
"Invalid distribution strategy: "
+ name
+ ". Valid values are: "
+ Arrays.toString(Strategy.values()));
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy