Skip to content
Open
Show file tree
Hide file tree
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 @@ -212,21 +212,16 @@ private static class PositionDeltaWriteFactory implements DeltaWriterFactory {
@Override
public DeltaWriter<InternalRow> createWriter(int partitionId, long taskId) {
int batchSize = writeOptions.getBatchSize();
boolean useQueuedBuffer = writeOptions.isUseQueuedWriteBuffer();
int poolSize = writeOptions.getQueueDepth();
boolean useLargeVarTypes = writeOptions.isUseLargeVarTypes();
long maxBatchBytes = writeOptions.getMaxBatchBytes();

// Merge initial storage options with write options
WriteParams params = writeOptions.toWriteParams(initialStorageOptions);

// Select buffer type based on configuration
ArrowBatchWriteBuffer writeBuffer;
if (useQueuedBuffer) {
int queueDepth = writeOptions.getQueueDepth();
writeBuffer =
new QueuedArrowBatchWriteBuffer(sparkSchema, batchSize, queueDepth, useLargeVarTypes);
} else {
writeBuffer = new SemaphoreArrowBatchWriteBuffer(sparkSchema, batchSize, useLargeVarTypes);
}
ArrowBatchWriteBuffer writeBuffer =
new PooledArrowBatchWriteBuffer(
sparkSchema, batchSize, poolSize, useLargeVarTypes, maxBatchBytes);

// Create fragment in background thread
Callable<List<FragmentMetadata>> fragmentCreator =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,21 +212,16 @@ private static class PositionDeltaWriteFactory implements DeltaWriterFactory {
@Override
public DeltaWriter<InternalRow> createWriter(int partitionId, long taskId) {
int batchSize = writeOptions.getBatchSize();
boolean useQueuedBuffer = writeOptions.isUseQueuedWriteBuffer();
int poolSize = writeOptions.getQueueDepth();
boolean useLargeVarTypes = writeOptions.isUseLargeVarTypes();
long maxBatchBytes = writeOptions.getMaxBatchBytes();

// Merge initial storage options with write options
WriteParams params = writeOptions.toWriteParams(initialStorageOptions);

// Select buffer type based on configuration
ArrowBatchWriteBuffer writeBuffer;
if (useQueuedBuffer) {
int queueDepth = writeOptions.getQueueDepth();
writeBuffer =
new QueuedArrowBatchWriteBuffer(sparkSchema, batchSize, queueDepth, useLargeVarTypes);
} else {
writeBuffer = new SemaphoreArrowBatchWriteBuffer(sparkSchema, batchSize, useLargeVarTypes);
}
ArrowBatchWriteBuffer writeBuffer =
new PooledArrowBatchWriteBuffer(
sparkSchema, batchSize, poolSize, useLargeVarTypes, maxBatchBytes);

// Create fragment in background thread
Callable<List<FragmentMetadata>> fragmentCreator =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@
* Abstract base class for Arrow batch write buffers that bridge Spark row writing and Lance
* fragment creation.
*
* <p>Both {@link SemaphoreArrowBatchWriteBuffer} (lock-based) and {@link
* QueuedArrowBatchWriteBuffer} (queue-based) extend this class, allowing the write path to be
* configured at runtime.
* <p>{@link PooledArrowBatchWriteBuffer} extends this class, pre-allocating a pool of
* VectorSchemaRoots that are reused across batches to minimize allocation overhead.
*/
public abstract class ArrowBatchWriteBuffer extends ArrowReader {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,24 +131,16 @@ protected WriterFactory(
@Override
public DataWriter<InternalRow> createWriter(int partitionId, long taskId) {
int batchSize = writeOptions.getBatchSize();
boolean useQueuedBuffer = writeOptions.isUseQueuedWriteBuffer();
int poolSize = writeOptions.getQueueDepth();
boolean useLargeVarTypes = writeOptions.isUseLargeVarTypes();
long maxBatchBytes = writeOptions.getMaxBatchBytes();

// Merge initial storage options with write options
WriteParams params = writeOptions.toWriteParams(initialStorageOptions);

// Select buffer type based on configuration
ArrowBatchWriteBuffer writeBuffer;
if (useQueuedBuffer) {
int queueDepth = writeOptions.getQueueDepth();
writeBuffer =
new QueuedArrowBatchWriteBuffer(
schema, batchSize, queueDepth, useLargeVarTypes, maxBatchBytes);
} else {
writeBuffer =
new SemaphoreArrowBatchWriteBuffer(schema, batchSize, useLargeVarTypes, maxBatchBytes);
}
ArrowBatchWriteBuffer writeBuffer =
new PooledArrowBatchWriteBuffer(
schema, batchSize, poolSize, useLargeVarTypes, maxBatchBytes);

// Create fragment in background thread
Callable<List<FragmentMetadata>> fragmentCreator =
Expand Down
Loading
Loading