Class SplitWeight
java.lang.Object
io.trino.spi.SplitWeight
-
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic SplitWeightfromProportion(double weight) Produces aSplitWeightthat corresponds to thestandard()weight proportionally, i.e., a parameter of1.0will be equivalent to the standard weight and a value of0.5will be 1/2 of the standard split weight.static SplitWeightfromRawValue(long value) Produces aSplitWeightfrom the raw internal value representation.longlonginthashCode()static longrawValueForStandardSplitCount(int splitCount) static <T> longrawValueSum(Collection<T> collection, Function<T, SplitWeight> getter) static SplitWeightstandard()toString()
-
Method Details
-
getRawValue
public long getRawValue()- Returns:
- The internal integer representation for this weight value
-
equals
-
hashCode
-
toString
-
fromRawValue
Produces aSplitWeightfrom the raw internal value representation. This method is intended primarily for JSON deserialization, and connectors should use not call this factory method directly to constructSplitWeightinstances. Instead, connectors should usefromProportion(double)to avoid breakages that could arise ifUNIT_VALUEchanges in the future. -
fromProportion
Produces aSplitWeightthat corresponds to thestandard()weight proportionally, i.e., a parameter of1.0will be equivalent to the standard weight and a value of0.5will be 1/2 of the standard split weight. Valid arguments must be greater than zero and finite. Connectors should prefer constructing split weights using this factory method rather than passing a raw integer value in case the integer representation of a standard split needs to change in the future.- Parameters:
weight- the proportional weight relative to a standard split, expressed as a double- Returns:
- a
SplitWeightwith a raw value corresponding to the requested proportion
-
standard
-
rawValueForStandardSplitCount
public static long rawValueForStandardSplitCount(int splitCount) -
rawValueSum
-
getRetainedSizeInBytes
public long getRetainedSizeInBytes()
-