Package io.trino.spi

Class SplitWeight

java.lang.Object
io.trino.spi.SplitWeight

public final class SplitWeight extends Object
  • Method Details

    • getRawValue

      public long getRawValue()
      Returns:
      The internal integer representation for this weight value
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • fromRawValue

      public static SplitWeight fromRawValue(long value)
      Produces a SplitWeight from the raw internal value representation. This method is intended primarily for JSON deserialization, and connectors should use not call this factory method directly to construct SplitWeight instances. Instead, connectors should use fromProportion(double) to avoid breakages that could arise if UNIT_VALUE changes in the future.
    • fromProportion

      public static SplitWeight fromProportion(double weight)
      Produces a SplitWeight that corresponds to the standard() weight proportionally, i.e., a parameter of 1.0 will be equivalent to the standard weight and a value of 0.5 will 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 SplitWeight with a raw value corresponding to the requested proportion
    • standard

      public static SplitWeight standard()
    • rawValueForStandardSplitCount

      public static long rawValueForStandardSplitCount(int splitCount)
    • rawValueSum

      public static <T> long rawValueSum(Collection<T> collection, Function<T,SplitWeight> getter)
    • getRetainedSizeInBytes

      public long getRetainedSizeInBytes()