-
Notifications
You must be signed in to change notification settings - Fork 3.9k
ARROW-347: Add method to pass CallBack to get Transfer Pair #182
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,8 @@ | |
| import org.apache.arrow.memory.BufferAllocator; | ||
|
|
||
| import io.netty.buffer.ArrowBuf; | ||
| import org.apache.arrow.vector.util.CallBack; | ||
| import org.apache.arrow.vector.util.TransferPair; | ||
|
|
||
|
|
||
| public abstract class BaseDataValueVector extends BaseValueVector implements BufferBacked { | ||
|
|
@@ -75,6 +77,11 @@ public void close() { | |
| super.close(); | ||
| } | ||
|
|
||
| @Override | ||
| public TransferPair getTransferPair(String ref, BufferAllocator allocator, CallBack callBack) { | ||
| return getTransferPair(ref, allocator); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we drop the callback here? |
||
| } | ||
|
|
||
| @Override | ||
| public ArrowBuf[] getBuffers(boolean clear) { | ||
| ArrowBuf[] out; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,7 @@ | |
| import org.apache.arrow.vector.complex.reader.FieldReader; | ||
| import org.apache.arrow.vector.types.Types.MinorType; | ||
| import org.apache.arrow.vector.types.pojo.Field; | ||
| import org.apache.arrow.vector.util.CallBack; | ||
| import org.apache.arrow.vector.util.TransferPair; | ||
|
|
||
| import io.netty.buffer.ArrowBuf; | ||
|
|
@@ -106,6 +107,8 @@ public interface ValueVector extends Closeable, Iterable<ValueVector> { | |
|
|
||
| TransferPair getTransferPair(String ref, BufferAllocator allocator); | ||
|
|
||
| TransferPair getTransferPair(String ref, BufferAllocator allocator, CallBack callBack); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why don't we just add a parameter to the existing method? |
||
|
|
||
| /** | ||
| * Returns a new {@link org.apache.arrow.vector.util.TransferPair transfer pair} that is used to transfer underlying | ||
| * buffers into the target vector. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -135,7 +135,12 @@ public FieldVector getDataVector() { | |
|
|
||
| @Override | ||
| public TransferPair getTransferPair(String ref, BufferAllocator allocator) { | ||
| return new TransferImpl(ref, allocator); | ||
| return getTransferPair(ref, allocator, null); | ||
| } | ||
|
|
||
| @Override | ||
| public TransferPair getTransferPair(String ref, BufferAllocator allocator, CallBack callBack) { | ||
| return null; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ? that's different from the original behavior. What's the intent? |
||
| } | ||
|
|
||
| @Override | ||
|
|
@@ -148,8 +153,8 @@ private class TransferImpl implements TransferPair { | |
| ListVector to; | ||
| TransferPair pairs[] = new TransferPair[3]; | ||
|
|
||
| public TransferImpl(String name, BufferAllocator allocator) { | ||
| this(new ListVector(name, allocator, null)); | ||
| public TransferImpl(String name, BufferAllocator allocator, CallBack callBack) { | ||
| this(new ListVector(name, allocator, callBack)); | ||
| } | ||
|
|
||
| public TransferImpl(ListVector to) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -83,7 +83,7 @@ public FieldReader getReader() { | |
|
|
||
| @Override | ||
| public TransferPair getTransferPair(BufferAllocator allocator) { | ||
| return new NullableMapTransferPair(this, new NullableMapVector(name, allocator, callBack), false); | ||
| return new NullableMapTransferPair(this, new NullableMapVector(name, allocator, null), false); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could just call the one bellow with name as ref. |
||
| } | ||
|
|
||
| @Override | ||
|
|
@@ -93,6 +93,11 @@ public TransferPair makeTransferPair(ValueVector to) { | |
|
|
||
| @Override | ||
| public TransferPair getTransferPair(String ref, BufferAllocator allocator) { | ||
| return new NullableMapTransferPair(this, new NullableMapVector(ref, allocator, null), false); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could just call the other one with null param |
||
| } | ||
|
|
||
| @Override | ||
| public TransferPair getTransferPair(String ref, BufferAllocator allocator, CallBack callBack) { | ||
| return new NullableMapTransferPair(this, new NullableMapVector(ref, allocator, callBack), false); | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need to keep this method?