diff --git a/core/trino-spi/src/main/java/io/trino/spi/block/DictionaryBlock.java b/core/trino-spi/src/main/java/io/trino/spi/block/DictionaryBlock.java index 20df70592aca..cd817d283b34 100644 --- a/core/trino-spi/src/main/java/io/trino/spi/block/DictionaryBlock.java +++ b/core/trino-spi/src/main/java/io/trino/spi/block/DictionaryBlock.java @@ -273,6 +273,12 @@ public long getLogicalSizeInBytes() return logicalSizeInBytes; } + OptionalInt dictionarySizePerPosition = dictionary.fixedSizeInBytesPerPosition(); + if (dictionarySizePerPosition.isPresent()) { + logicalSizeInBytes = dictionarySizePerPosition.getAsInt() * (long) getPositionCount(); + return logicalSizeInBytes; + } + // Calculation of logical size can be performed as part of calculateCompactSize() with minor modifications. // Keeping this calculation separate as this is a little more expensive and may not be called as often. long sizeInBytes = 0;