Package io.trino.spi.type
Class BooleanType
java.lang.Object
io.trino.spi.type.AbstractType
io.trino.spi.type.BooleanType
- All Implemented Interfaces:
FixedWidthType,Type
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.trino.spi.type.Type
Type.Range -
Field Summary
Fields -
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.static BlockcreateBlockForSingleNonNullValue(boolean value) createFixedSizeBlockBuilder(int positionCount) Creates a block builder for this type sized to hold the specified number of positions.booleanbooleangetBoolean(Block block, int position) Gets the value at theblockpositionas a boolean.intGets the size of a value of this type in bytes.intReturns the fixed size of this type when written to a flat buffer.getObjectValue(ConnectorSession session, Block block, int position) Gets an object representation of the type value in theblockposition.getTypeOperatorDeclaration(TypeOperators typeOperators) Gets the declared type specific operators for this type.inthashCode()booleanTrue if the type supports equalTo and hash.booleanTrue if the type supports compareTo.static BlockwrapByteArrayAsBooleanBlockWithoutNulls(byte[] booleansAsBytes) This method signifies a contract to callers that as an optimization, they can encode BooleanType blocks as a byte[] directly and potentially bypass the BlockBuilder / BooleanType abstraction in the name of efficiency.voidwriteBoolean(BlockBuilder blockBuilder, boolean value) Writes the boolean value into theBlockBuilder.Methods inherited from class io.trino.spi.type.AbstractType
getDisplayName, getDouble, getJavaType, getLong, getObject, getSlice, getTypeParameters, getTypeSignature, getValueBlockType, toString, writeDouble, writeLong, writeObject, writeSlice, writeSliceMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface io.trino.spi.type.FixedWidthType
getFlatVariableWidthSize, isFlatVariableWidth, relocateFlatVariableWidthOffsetsMethods inherited from interface io.trino.spi.type.Type
getBaseName, getDiscreteValues, getDisplayName, getDouble, getJavaType, getLong, getNextValue, getObject, getPreviousValue, getRange, getSlice, getTypeId, getTypeParameters, getTypeSignature, getValueBlockType, writeDouble, writeLong, writeObject, writeSlice, writeSlice
-
Field Details
-
BOOLEAN
-
-
Method Details
-
wrapByteArrayAsBooleanBlockWithoutNulls
This method signifies a contract to callers that as an optimization, they can encode BooleanType blocks as a byte[] directly and potentially bypass the BlockBuilder / BooleanType abstraction in the name of efficiency. If in the future BooleanType encoding changes such thatByteArrayBlockis not always a valid or efficient representation, then this method must be removed and any usages changed -
createBlockForSingleNonNullValue
-
getFixedSize
public int getFixedSize()Description copied from interface:FixedWidthTypeGets the size of a value of this type in bytes. All values of a FixedWidthType are the same size.- Specified by:
getFixedSizein interfaceFixedWidthType
-
createBlockBuilder
public BlockBuilder createBlockBuilder(BlockBuilderStatus blockBuilderStatus, int expectedEntries, int expectedBytesPerEntry) Description copied from interface:TypeCreates the preferred block builder for this type. This is the builder used to store values after an expression projection within the query.- Specified by:
createBlockBuilderin interfaceType
-
createBlockBuilder
Description copied from interface:TypeCreates the preferred block builder for this type. This is the builder used to store values after an expression projection within the query.- Specified by:
createBlockBuilderin interfaceType
-
createFixedSizeBlockBuilder
Description copied from interface:FixedWidthTypeCreates a block builder for this type sized to hold the specified number of positions.- Specified by:
createFixedSizeBlockBuilderin interfaceFixedWidthType
-
isComparable
public boolean isComparable()Description copied from interface:TypeTrue if the type supports equalTo and hash.- Specified by:
isComparablein interfaceType- Overrides:
isComparablein classAbstractType
-
isOrderable
public boolean isOrderable()Description copied from interface:TypeTrue if the type supports compareTo.- Specified by:
isOrderablein interfaceType- Overrides:
isOrderablein classAbstractType
-
getTypeOperatorDeclaration
Description copied from interface:TypeGets the declared type specific operators for this type.- Specified by:
getTypeOperatorDeclarationin interfaceType
-
getObjectValue
Description copied from interface:TypeGets 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.- Specified by:
getObjectValuein interfaceType
-
appendTo
Description copied from interface:TypeAppend the value atpositioninblocktoblockBuilder. -
getBoolean
Description copied from interface:TypeGets the value at theblockpositionas a boolean.- Specified by:
getBooleanin interfaceType- Overrides:
getBooleanin classAbstractType
-
writeBoolean
Description copied from interface:TypeWrites the boolean value into theBlockBuilder.- Specified by:
writeBooleanin interfaceType- Overrides:
writeBooleanin classAbstractType
-
getFlatFixedSize
public int getFlatFixedSize()Description copied from interface:TypeReturns the fixed size of this type when written to a flat buffer.- Specified by:
getFlatFixedSizein interfaceType
-
equals
- Overrides:
equalsin classAbstractType
-
hashCode
public int hashCode()- Overrides:
hashCodein classAbstractType
-