Interface Type
- All Known Subinterfaces:
FixedWidthType,VariableWidthType
- All Known Implementing Classes:
AbstractIntType,AbstractLongType,AbstractType,AbstractVariableWidthType,ArrayType,BigintType,BooleanType,CharType,DateType,DecimalType,DoubleType,HyperLogLogType,IntegerType,MapType,P4HyperLogLogType,QuantileDigestType,RealType,RowType,SmallintType,TimestampType,TimestampWithTimeZoneType,TimeType,TimeWithTimeZoneType,TinyintType,UuidType,VarbinaryType,VarcharType
public interface Type
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoidappendTo(Block block, int position, BlockBuilder blockBuilder) Append the value atpositioninblocktoblockBuilder.createBlockBuilder(BlockBuilderStatus blockBuilderStatus, int expectedEntries) Creates the preferred block builder for this type.createBlockBuilder(BlockBuilderStatus blockBuilderStatus, int expectedEntries, int expectedBytesPerEntry) Creates the preferred block builder for this type.default ValueBlockCreates a block containing as single null values.default StringReturns the base name of this type.booleangetBoolean(Block block, int position) Gets the value at theblockpositionas a boolean.getDiscreteValues(Type.Range range) Returns a stream of discrete values inside the specified range (if supported by this type).Returns the name of this type that should be displayed to end-users.doubleGets the value at theblockpositionas a double.intReturns the fixed size of this type when written to a flat buffer.intgetFlatVariableWidthSize(Block block, int position) Returns the variable width size of the value at the specified position when written to a flat buffer.Class<?> Gets the Java class type used to represent this value on the stack during expression execution.longGets the value at theblockpositionas a long.getNextValue(Object value) Returns the minimum value that compares greater thanvalue.Gets the value at theblockpositionas an Object.getObjectValue(ConnectorSession session, Block block, int position) Gets an object representation of the type value in theblockposition.getPreviousValue(Object value) Returns the maximum value that compares less thanvalue.default Optional<Type.Range> getRange()Return the range of possible values for this type, if available.io.airlift.slice.SliceGets the value at theblockpositionas a Slice.default TypeIddefault TypeOperatorDeclarationgetTypeOperatorDeclaration(TypeOperators typeOperators) Gets the declared type specific operators for this type.For parameterized types returns the list of parameters.Gets the name of this type which must be case insensitive globally unique.Class<? extends ValueBlock> Gets the ValueBlock type used to store values of this type.booleanTrue if the type supports equalTo and hash.booleanReturns true if this type is variable width when written to a flat buffer.booleanTrue if the type supports compareTo.intrelocateFlatVariableWidthOffsets(byte[] fixedSizeSlice, int fixedSizeOffset, byte[] variableSizeSlice, int variableSizeOffset) Update the variable width offsets recorded in the value.voidwriteBoolean(BlockBuilder blockBuilder, boolean value) Writes the boolean value into theBlockBuilder.voidwriteDouble(BlockBuilder blockBuilder, double value) Writes the double value into theBlockBuilder.voidwriteLong(BlockBuilder blockBuilder, long value) Writes the long value into theBlockBuilder.voidwriteObject(BlockBuilder blockBuilder, Object value) Writes the Object value into theBlockBuilder.voidwriteSlice(BlockBuilder blockBuilder, io.airlift.slice.Slice value) Writes the Slice value into theBlockBuilder.voidwriteSlice(BlockBuilder blockBuilder, io.airlift.slice.Slice value, int offset, int length) Writes the Slice value into theBlockBuilder.
-
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
-
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
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
-
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
Creates the preferred block builder for this type. This is the builder used to store values after an expression projection within the query. -
createNullBlock
Creates a block containing as single null values. -
getObjectValue
Gets an object representation of the type value in theblockposition. This is the value returned to the user via the REST endpoint and therefore must be JSON serializable. -
getBoolean
Gets the value at theblockpositionas a boolean. -
getLong
Gets the value at theblockpositionas a long. -
getDouble
Gets the value at theblockpositionas a double. -
getSlice
Gets the value at theblockpositionas a Slice. -
getObject
-
writeBoolean
Writes the boolean value into theBlockBuilder. -
writeLong
Writes the long value into theBlockBuilder. -
writeDouble
Writes the double value into theBlockBuilder. -
writeSlice
Writes the Slice value into theBlockBuilder. -
writeSlice
Writes the Slice value into theBlockBuilder. -
writeObject
Writes the Object value into theBlockBuilder. -
appendTo
Append the value atpositioninblocktoblockBuilder. -
getRange
Return the range of possible values for this type, if available.The type of the values must match
getJavaType() -
getPreviousValue
Returns the maximum value that compares less thanvalue.The type of the value must match
getJavaType().- Throws:
IllegalStateException- if this type is notorderable
-
getNextValue
Returns the minimum value that compares greater thanvalue.The type of the value must match
getJavaType().- Throws:
IllegalStateException- if this type is notorderable
-
getDiscreteValues
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
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
-