1
1
mirror of https://github.com/MarginaliaSearch/MarginaliaSearch.git synced 2025-10-05 21:22:39 +02:00

(converter) Amend existing modifications to use gamma coded positions lists

... instead of serialized RoaringBitmaps as was the initial take on the problem.
This commit is contained in:
Viktor Lofgren
2024-05-30 14:20:36 +02:00
parent 0112ae725c
commit 9b922af075
18 changed files with 92 additions and 63 deletions

View File

@@ -138,6 +138,15 @@ public final class ParquetWriter<T> implements Closeable {
SimpleWriteSupport.this.writeList(name, value);
}
@Override
public void writeBinarySerializableList(String name, List<? extends BinarySerializable> value) {
if (value.isEmpty()) {
return;
}
SimpleWriteSupport.this.writeBinarySerializableList(name, value);
}
@Override
public void writeList(String name, TIntList value) {
if (value.isEmpty()) {
@@ -209,6 +218,18 @@ public final class ParquetWriter<T> implements Closeable {
recordConsumer.endField(name, fieldIndex);
}
private void writeBinarySerializableList(String name, List<? extends BinarySerializable> values) {
int fieldIndex = schema.getFieldIndex(name);
PrimitiveType type = schema.getType(fieldIndex).asPrimitiveType();
recordConsumer.startField(name, fieldIndex);
for (var value : values) {
writeValue(type, value.bytes());
}
recordConsumer.endField(name, fieldIndex);
}
private void writeList(String name, TIntList values) {
int fieldIndex = schema.getFieldIndex(name);
PrimitiveType type = schema.getType(fieldIndex).asPrimitiveType();

View File

@@ -9,5 +9,6 @@ public interface ValueWriter {
void write(String name, Object value);
void writeList(String name, List<?> value);
void writeList(String name, TLongList value);
void writeBinarySerializableList(String name, List<? extends BinarySerializable> value);
void writeList(String name, TIntList value);
}