diff --git a/core/trino-spi/src/main/java/io/trino/spi/block/ArrayBlock.java b/core/trino-spi/src/main/java/io/trino/spi/block/ArrayBlock.java index 4914b218338d..a10f87c79e25 100644 --- a/core/trino-spi/src/main/java/io/trino/spi/block/ArrayBlock.java +++ b/core/trino-spi/src/main/java/io/trino/spi/block/ArrayBlock.java @@ -165,6 +165,13 @@ public void retainedBytesForEachPart(ObjLongConsumer consumer) consumer.accept(this, INSTANCE_SIZE); } + public Block getElementsBlock() + { + int start = offsets[arrayOffset]; + int end = offsets[arrayOffset + positionCount]; + return values.getRegion(start, end - start); + } + Block getRawElementBlock() { return values; diff --git a/core/trino-spi/src/main/java/io/trino/spi/block/MapBlock.java b/core/trino-spi/src/main/java/io/trino/spi/block/MapBlock.java index aa12a2712615..f95ce3f09bac 100644 --- a/core/trino-spi/src/main/java/io/trino/spi/block/MapBlock.java +++ b/core/trino-spi/src/main/java/io/trino/spi/block/MapBlock.java @@ -186,6 +186,20 @@ private MapBlock( this.retainedSizeInBytes = INSTANCE_SIZE + sizeOf(offsets) + sizeOf(mapIsNull); } + public Block getKeyBlock() + { + int start = offsets[startOffset]; + int end = offsets[startOffset + positionCount]; + return keyBlock.getRegion(start, end - start); + } + + public Block getValueBlock() + { + int start = offsets[startOffset]; + int end = offsets[startOffset + positionCount]; + return valueBlock.getRegion(start, end - start); + } + Block getRawKeyBlock() { return keyBlock;