Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@
MANIFEST

cpp/.idea/
python/.eggs/
python/.eggs/
.idea/
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import java.util.ArrayList;
import java.util.List;
import java.lang.reflect.Field;

import org.apache.arrow.memory.BufferAllocator;
import org.apache.arrow.vector.schema.ArrowFieldNode;
Expand All @@ -27,6 +28,8 @@
import org.apache.arrow.vector.util.CallBack;
import org.apache.arrow.vector.util.TransferPair;

import com.google.common.base.Throwables;


public abstract class BaseDataValueVector extends BaseValueVector implements BufferBacked {

Expand Down Expand Up @@ -140,4 +143,14 @@ public ArrowBuf unLoad() {
* the value vector. The purpose is to move the value vector to a "mutate" state
*/
public void reset() {}

public void setLastSet(int value) {
try {
Field f = this.getMutator().getClass().getDeclaredField("lastSet");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should avoid reflection here and below. Implement methods directly.

f.setAccessible(true);
f.set(this.getMutator(), value);
} catch (Exception ex) {
throw Throwables.propagate(ex);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,11 @@ public static boolean checkBufRefs(final ValueVector vv) {
public BufferAllocator getAllocator() {
return allocator;
}

/**
* Sets the last number of values stored in this vector to the given value count
* @param value the last count to set
*/
public abstract void setLastSet(int value);
}

Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.List;
import java.util.Objects;

import com.google.common.base.Throwables;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ObjectArrays;
Expand Down Expand Up @@ -401,4 +402,14 @@ public void copyValueSafe(int from, int to) {
}
}
}

public void setLastSet(int value) {
try {
java.lang.reflect.Field f = this.getMutator().getClass().getDeclaredField("lastSet");
f.setAccessible(true);
f.set(this.getMutator(), value);
} catch (Exception ex) {
throw Throwables.propagate(ex);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.util.Collections;
import java.util.List;

import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ObjectArrays;

Expand Down Expand Up @@ -411,4 +412,13 @@ public void setValueCount(int valueCount) {
}
}

public void setLastSet(int value) {
try {
java.lang.reflect.Field f = this.getMutator().getClass().getDeclaredField("lastSet");
f.setAccessible(true);
f.set(this.getMutator(), value);
} catch (Exception ex) {
throw Throwables.propagate(ex);
}
}
}