Skip to content
Closed
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 @@ -21,6 +21,7 @@

import java.lang.invoke.MethodHandle;
import java.util.Arrays;
import java.util.Objects;
import java.util.Optional;

import static com.facebook.presto.common.block.BlockUtil.appendNullToIsNullArray;
Expand Down Expand Up @@ -468,6 +469,26 @@ public void loadHashTables(int positionCount, int[] offsets, boolean[] mapIsNull
}
set(hashTables);
}

@Override
public boolean equals(Object obj)
{
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
HashTables other = (HashTables) obj;
return Arrays.equals(this.hashTables, other.hashTables) &&
Objects.equals(this.expectedHashTableCount, other.expectedHashTableCount);
}

@Override
public int hashCode()
{
return Objects.hash(Arrays.hashCode(hashTables), expectedHashTableCount);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

import javax.annotation.Nullable;

import java.util.Arrays;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;

Expand Down Expand Up @@ -223,4 +225,37 @@ public Block getSingleValueBlock(int position)

return getSingleValueBlockInternal(position);
}

@Override
public boolean equals(Object obj)
{
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
ArrayBlock other = (ArrayBlock) obj;
return Objects.equals(this.arrayOffset, other.arrayOffset) &&
Objects.equals(this.positionCount, other.positionCount) &&
Arrays.equals(this.valueIsNull, other.valueIsNull) &&
Objects.equals(this.values, other.values) &&
Arrays.equals(this.offsets, other.offsets) &&
Objects.equals(this.sizeInBytes, other.sizeInBytes) &&
Objects.equals(this.logicalSizeInBytes, other.logicalSizeInBytes) &&
Objects.equals(this.retainedSizeInBytes, other.retainedSizeInBytes);
}

@Override
public int hashCode()
{
return Objects.hash(arrayOffset,
positionCount,
Arrays.hashCode(valueIsNull),
values,
Arrays.hashCode(offsets),
sizeInBytes,
logicalSizeInBytes,
retainedSizeInBytes);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

import javax.annotation.Nullable;

import java.util.Arrays;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;

Expand Down Expand Up @@ -264,4 +266,33 @@ public Block appendNull()

return new ByteArrayBlock(arrayOffset, positionCount + 1, newValueIsNull, newValues);
}

@Override
public boolean equals(Object obj)
{
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
ByteArrayBlock other = (ByteArrayBlock) obj;
return Objects.equals(this.arrayOffset, other.arrayOffset) &&
Objects.equals(this.positionCount, other.positionCount) &&
Arrays.equals(this.valueIsNull, other.valueIsNull) &&
Arrays.equals(this.values, other.values) &&
Objects.equals(this.sizeInBytes, other.sizeInBytes) &&
Objects.equals(this.retainedSizeInBytes, other.retainedSizeInBytes);
}

@Override
public int hashCode()
{
return Objects.hash(arrayOffset,
positionCount,
Arrays.hashCode(valueIsNull),
Arrays.hashCode(values),
sizeInBytes,
retainedSizeInBytes);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.function.BiConsumer;

import static com.facebook.presto.common.block.BlockUtil.checkArrayRange;
Expand Down Expand Up @@ -608,4 +609,39 @@ public Block appendNull()

return new DictionaryBlock(idsOffset, positionCount + 1, newDictionary, newIds, isCompact(), getDictionarySourceId());
}

@Override
public boolean equals(Object obj)
{
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
DictionaryBlock other = (DictionaryBlock) obj;
return Objects.equals(this.positionCount, other.positionCount) &&
Objects.equals(this.dictionary, other.dictionary) &&
Objects.equals(this.idsOffset, other.idsOffset) &&
Arrays.equals(this.ids, other.ids) &&
Objects.equals(this.retainedSizeInBytes, other.retainedSizeInBytes) &&
Objects.equals(this.sizeInBytes, other.sizeInBytes) &&
Objects.equals(this.logicalSizeInBytes, other.logicalSizeInBytes) &&
Objects.equals(this.uniqueIds, other.uniqueIds) &&
Objects.equals(this.dictionarySourceId, other.dictionarySourceId);
}

@Override
public int hashCode()
{
return Objects.hash(positionCount,
dictionary,
idsOffset,
Arrays.hashCode(ids),
retainedSizeInBytes,
sizeInBytes,
logicalSizeInBytes,
uniqueIds,
dictionarySourceId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

import javax.annotation.Nullable;

import java.util.Arrays;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;

Expand Down Expand Up @@ -359,4 +361,33 @@ public Block appendNull()
long[] newValues = ensureCapacity(values, (positionOffset + positionCount + 1) * 2);
return new Int128ArrayBlock(positionOffset, positionCount + 1, newValueIsNull, newValues);
}

@Override
public boolean equals(Object obj)
{
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
Int128ArrayBlock other = (Int128ArrayBlock) obj;
return Objects.equals(this.positionOffset, other.positionOffset) &&
Objects.equals(this.positionCount, other.positionCount) &&
Arrays.equals(this.valueIsNull, other.valueIsNull) &&
Arrays.equals(this.values, other.values) &&
Objects.equals(this.sizeInBytes, other.sizeInBytes) &&
Objects.equals(this.retainedSizeInBytes, other.retainedSizeInBytes);
}

@Override
public int hashCode()
{
return Objects.hash(positionOffset,
positionCount,
Arrays.hashCode(valueIsNull),
Arrays.hashCode(values),
sizeInBytes,
retainedSizeInBytes);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

import javax.annotation.Nullable;

import java.util.Arrays;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;

Expand Down Expand Up @@ -302,4 +304,33 @@ public Block appendNull()

return new LongArrayBlock(arrayOffset, positionCount + 1, newValueIsNull, newValues);
}

@Override
public boolean equals(Object obj)
{
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
LongArrayBlock other = (LongArrayBlock) obj;
return Objects.equals(this.arrayOffset, other.arrayOffset) &&
Objects.equals(this.positionCount, other.positionCount) &&
Arrays.equals(this.valueIsNull, other.valueIsNull) &&
Arrays.equals(this.values, other.values) &&
Objects.equals(this.sizeInBytes, other.sizeInBytes) &&
Objects.equals(this.retainedSizeInBytes, other.retainedSizeInBytes);
}

@Override
public int hashCode()
{
return Objects.hash(arrayOffset,
positionCount,
Arrays.hashCode(valueIsNull),
Arrays.hashCode(values),
sizeInBytes,
retainedSizeInBytes);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import javax.annotation.Nullable;

import java.lang.invoke.MethodHandle;
import java.util.Arrays;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;

Expand Down Expand Up @@ -300,4 +302,39 @@ protected void ensureHashTableLoaded(MethodHandle keyBlockHashCode)
}
}
}

@Override
public boolean equals(Object obj)
{
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
MapBlock other = (MapBlock) obj;
return Objects.equals(this.startOffset, other.startOffset) &&
Objects.equals(this.positionCount, other.positionCount) &&
Arrays.equals(this.mapIsNull, other.mapIsNull) &&
Arrays.equals(this.offsets, other.offsets) &&
Objects.equals(this.keyBlock, other.keyBlock) &&
Objects.equals(this.valueBlock, other.valueBlock) &&
Objects.equals(this.hashTables, other.hashTables) &&
Objects.equals(this.retainedSizeInBytesExceptHashtable, other.retainedSizeInBytesExceptHashtable) &&
Objects.equals(this.sizeInBytes, other.sizeInBytes);
}

@Override
public int hashCode()
{
return Objects.hash(startOffset,
positionCount,
Arrays.hashCode(mapIsNull),
Arrays.hashCode(offsets),
keyBlock,
valueBlock,
hashTables,
retainedSizeInBytesExceptHashtable,
sizeInBytes);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

import javax.annotation.Nullable;

import java.util.Arrays;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;

Expand Down Expand Up @@ -240,4 +242,37 @@ public Block getLoadedBlock()
fieldBlockOffsets,
loadedFieldBlocks);
}

@Override
public boolean equals(Object obj)
{
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
RowBlock other = (RowBlock) obj;
return Objects.equals(this.startOffset, other.startOffset) &&
Objects.equals(this.positionCount, other.positionCount) &&
Arrays.equals(this.rowIsNull, other.rowIsNull) &&
Arrays.equals(this.fieldBlockOffsets, other.fieldBlockOffsets) &&
Arrays.equals(this.fieldBlocks, other.fieldBlocks) &&
Objects.equals(this.sizeInBytes, other.sizeInBytes) &&
Objects.equals(this.logicalSizeInBytes, other.logicalSizeInBytes) &&
Objects.equals(this.retainedSizeInBytes, other.retainedSizeInBytes);
}

@Override
public int hashCode()
{
return Objects.hash(startOffset,
positionCount,
Arrays.hashCode(rowIsNull),
Arrays.hashCode(fieldBlockOffsets),
Arrays.hashCode(fieldBlocks),
sizeInBytes,
logicalSizeInBytes,
retainedSizeInBytes);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import io.airlift.slice.SliceOutput;
import org.openjdk.jol.info.ClassLayout;

import java.util.Objects;
import java.util.function.BiConsumer;

import static com.facebook.presto.common.block.BlockUtil.checkArrayRange;
Expand Down Expand Up @@ -411,4 +412,24 @@ public Block appendNull()
return new DictionaryBlock(dictionary, ids);
}
}

@Override
public boolean equals(Object obj)
{
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
RunLengthEncodedBlock other = (RunLengthEncodedBlock) obj;
return Objects.equals(this.value, other.value) &&
Objects.equals(this.positionCount, other.positionCount);
}

@Override
public int hashCode()
{
return Objects.hash(value, positionCount);
}
}
Loading