Interface Type

  • Method Details

    • getTypeSignature

      TypeSignature getTypeSignature()
      Gets the name of this type which must be case insensitive globally unique. The name of a user defined type must be a legal identifier in Trino.
    • getTypeId

      default TypeId getTypeId()
    • getBaseName

      default String getBaseName()
      Returns the base name of this type. For simple types, it is the type name. For complex types (row, array, etc), it is the type name without any parameters.
    • getDisplayName

      String getDisplayName()
      Returns the name of this type that should be displayed to end-users.
    • isComparable

      boolean isComparable()
      True if the type supports equalTo and hash.
    • isOrderable

      boolean isOrderable()
      True if the type supports compareTo.
    • getTypeOperatorDeclaration

      default TypeOperatorDeclaration getTypeOperatorDeclaration(TypeOperators typeOperators)
      Gets the declared type specific operators for this type.
    • getJavaType

      Class<?> getJavaType()
      Gets the Java class type used to represent this value on the stack during expression execution.

      Currently, this can be boolean, long, double, or a non-primitive type.

    • getValueBlockType

      Class<? extends ValueBlock> getValueBlockType()
      Gets the ValueBlock type used to store values of this type.
    • getTypeParameters

      List<Type> getTypeParameters()
      For parameterized types returns the list of parameters.
    • createBlockBuilder

      BlockBuilder createBlockBuilder(BlockBuilderStatus blockBuilderStatus, int expectedEntries, int expectedBytesPerEntry)
      Creates the preferred block builder for this type. This is the builder used to store values after an expression projection within the query.
    • createBlockBuilder

      BlockBuilder createBlockBuilder(BlockBuilderStatus blockBuilderStatus, int expectedEntries)
      Creates the preferred block builder for this type. This is the builder used to store values after an expression projection within the query.
    • createNullBlock

      default ValueBlock createNullBlock()
      Creates a block containing as single null values.
    • getObjectValue

      Object getObjectValue(ConnectorSession session, Block block, int position)
      Gets an object representation of the type value in the block position. This is the value returned to the user via the REST endpoint and therefore must be JSON serializable.
    • getBoolean

      boolean getBoolean(Block block, int position)
      Gets the value at the block position as a boolean.
    • getLong

      long getLong(Block block, int position)
      Gets the value at the block position as a long.
    • getDouble

      double getDouble(Block block, int position)
      Gets the value at the block position as a double.
    • getSlice

      io.airlift.slice.Slice getSlice(Block block, int position)
      Gets the value at the block position as a Slice.
    • getObject

      Object getObject(Block block, int position)
      Gets the value at the block position as an Object.
    • writeBoolean

      void writeBoolean(BlockBuilder blockBuilder, boolean value)
      Writes the boolean value into the BlockBuilder.
    • writeLong

      void writeLong(BlockBuilder blockBuilder, long value)
      Writes the long value into the BlockBuilder.
    • writeDouble

      void writeDouble(BlockBuilder blockBuilder, double value)
      Writes the double value into the BlockBuilder.
    • writeSlice

      void writeSlice(BlockBuilder blockBuilder, io.airlift.slice.Slice value)
      Writes the Slice value into the BlockBuilder.
    • writeSlice

      void writeSlice(BlockBuilder blockBuilder, io.airlift.slice.Slice value, int offset, int length)
      Writes the Slice value into the BlockBuilder.
    • writeObject

      void writeObject(BlockBuilder blockBuilder, Object value)
      Writes the Object value into the BlockBuilder.
    • appendTo

      void appendTo(Block block, int position, BlockBuilder blockBuilder)
      Append the value at position in block to blockBuilder.
    • getRange

      default Optional<Type.Range> getRange()
      Return the range of possible values for this type, if available.

      The type of the values must match getJavaType()

    • getPreviousValue

      default Optional<Object> getPreviousValue(Object value)
      Returns the maximum value that compares less than value.

      The type of the value must match getJavaType().

      Throws:
      IllegalStateException - if this type is not orderable
    • getNextValue

      default Optional<Object> getNextValue(Object value)
      Returns the minimum value that compares greater than value.

      The type of the value must match getJavaType().

      Throws:
      IllegalStateException - if this type is not orderable
    • getDiscreteValues

      default Optional<Stream<?>> getDiscreteValues(Type.Range range)
      Returns a stream of discrete values inside the specified range (if supported by this type).
    • getFlatFixedSize

      int getFlatFixedSize()
      Returns the fixed size of this type when written to a flat buffer.
    • isFlatVariableWidth

      boolean isFlatVariableWidth()
      Returns true if this type is variable width when written to a flat buffer.
    • getFlatVariableWidthSize

      int getFlatVariableWidthSize(Block block, int position)
      Returns the variable width size of the value at the specified position when written to a flat buffer.
    • relocateFlatVariableWidthOffsets

      int relocateFlatVariableWidthOffsets(byte[] fixedSizeSlice, int fixedSizeOffset, byte[] variableSizeSlice, int variableSizeOffset)
      Update the variable width offsets recorded in the value. This method is called after the value has been moved to a new location, and therefore the offsets need to be updated. Returns the length of the variable width data, so container types can update their offsets.
      Returns:
      the length of the variable width data