Skip to content

Commit

Permalink
fix: addressing reviews v3
Browse files Browse the repository at this point in the history
  • Loading branch information
vibhatha committed Sep 3, 2024
1 parent 875e33a commit 6fbf36c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,9 @@ public interface AllocationReservation extends AutoCloseable {
* use getLongSize instead.
*
* @return size of the current reservation
* @deprecated use {@link #getLongSize()} instead
*/
@Deprecated
int getSize();

/**
* Get the current size of the reservation (the sum of all the add()s).
*
* @return size of the current reservation
*/
long getLongSize();

/**
* Return whether or not the reservation has been used.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -955,17 +955,11 @@ public ArrowBuf allocateBuffer() {
return arrowBuf;
}

@Deprecated
@Override
public int getSize() {
return (int) nBytes;
}

@Override
public long getLongSize() {
return nBytes;
}

@Override
public boolean isUsed() {
return used;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@ public class LowCostIdentityHashMap<K, V extends ValueWithKeyIncluded<K>> {
private @Nullable Object[] elementData; // elementData[index] = null;

/* Actual number of values. */
private long size;
private int size;

/*
* maximum number of elements that can be put in this map before having to
* rehash.
*/
private long threshold;

private static final long DEFAULT_MIN_SIZE = 1;
private static final int DEFAULT_MIN_SIZE = 1;

/* Default load factor of 0.75; */
private static final long LOAD_FACTOR = 7500;
private static final int LOAD_FACTOR = 7500;

/** Creates a Map with default expected maximum size. */
public LowCostIdentityHashMap() {
Expand All @@ -60,9 +60,7 @@ public LowCostIdentityHashMap() {
* Creates a Map with the specified maximum size parameter.
*
* @param maxSize The estimated maximum number of entries that will be put in this map.
* @deprecated Use {@link #LowCostIdentityHashMap(long)} instead.
*/
@Deprecated
public LowCostIdentityHashMap(int maxSize) {
if (maxSize >= 0) {
this.size = 0;
Expand All @@ -73,21 +71,6 @@ public LowCostIdentityHashMap(int maxSize) {
}
}

/**
* Creates a Map with the specified maximum size parameter.
*
* @param maxSize The estimated maximum number of entries that will be put in this map.
*/
public LowCostIdentityHashMap(long maxSize) {
if (maxSize >= 0) {
this.size = 0;
threshold = getThreshold(maxSize);
elementData = newElementArrayUnderInitialized((int) computeElementArraySize());
} else {
throw new IllegalArgumentException();
}
}

private long getThreshold(@UnderInitialization LowCostIdentityHashMap<K, V> this, long maxSize) {
// assign the threshold to maxSize initially, this will change to a
// higher value if rehashing occurs.
Expand Down Expand Up @@ -334,7 +317,7 @@ public boolean isEmpty() {
* @return the number of mappings in this Map.
*/
public int size() {
return (int) size;
return size;
}

/**
Expand Down

0 comments on commit 6fbf36c

Please sign in to comment.