Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DictionaryEncodedColumnPartSerde: Read values using smooshReader. #17688

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.apache.druid.io.Channels;
import org.apache.druid.java.util.common.IAE;
import org.apache.druid.java.util.common.io.smoosh.FileSmoosher;
import org.apache.druid.java.util.common.io.smoosh.SmooshedFileMapper;
import org.apache.druid.segment.column.BaseColumn;
import org.apache.druid.segment.column.ColumnBuilder;
import org.apache.druid.segment.column.ColumnConfig;
Expand Down Expand Up @@ -332,10 +333,10 @@ public void read(
final WritableSupplier<ColumnarMultiInts> rMultiValuedColumn;

if (hasMultipleValues) {
rMultiValuedColumn = readMultiValuedColumn(rVersion, buffer, rFlags);
rMultiValuedColumn = readMultiValuedColumn(rVersion, buffer, rFlags, builder.getFileMapper());
rSingleValuedColumn = null;
} else {
rSingleValuedColumn = readSingleValuedColumn(rVersion, buffer);
rSingleValuedColumn = readSingleValuedColumn(rVersion, buffer, builder.getFileMapper());
rMultiValuedColumn = null;
}

Expand Down Expand Up @@ -381,20 +382,29 @@ public void read(
}
}

private WritableSupplier<ColumnarInts> readSingleValuedColumn(VERSION version, ByteBuffer buffer)
private WritableSupplier<ColumnarInts> readSingleValuedColumn(
VERSION version,
ByteBuffer buffer,
SmooshedFileMapper smooshReader
)
{
switch (version) {
case UNCOMPRESSED_SINGLE_VALUE:
case UNCOMPRESSED_WITH_FLAGS:
return VSizeColumnarInts.readFromByteBuffer(buffer);
case COMPRESSED:
return CompressedVSizeColumnarIntsSupplier.fromByteBuffer(buffer, byteOrder);
return CompressedVSizeColumnarIntsSupplier.fromByteBuffer(buffer, byteOrder, smooshReader);
default:
throw new IAE("Unsupported single-value version[%s]", version);
}
}

private WritableSupplier<ColumnarMultiInts> readMultiValuedColumn(VERSION version, ByteBuffer buffer, int flags)
private WritableSupplier<ColumnarMultiInts> readMultiValuedColumn(
VERSION version,
ByteBuffer buffer,
int flags,
SmooshedFileMapper smooshReader
)
{
switch (version) {
case UNCOMPRESSED_MULTI_VALUE: {
Expand All @@ -411,7 +421,7 @@ private WritableSupplier<ColumnarMultiInts> readMultiValuedColumn(VERSION versio
if (Feature.MULTI_VALUE.isSet(flags)) {
return CompressedVSizeColumnarMultiIntsSupplier.fromByteBuffer(buffer, byteOrder);
} else if (Feature.MULTI_VALUE_V3.isSet(flags)) {
return V3CompressedVSizeColumnarMultiIntsSupplier.fromByteBuffer(buffer, byteOrder);
return V3CompressedVSizeColumnarMultiIntsSupplier.fromByteBuffer(buffer, byteOrder, smooshReader);
} else {
throw new IAE("Unrecognized multi-value flag[%d] for version[%s]", flags, version);
}
Expand Down
Loading