Skip to content
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

Fix infinite loop during planning caused by PickTableLayout #17720

Merged
merged 1 commit into from
May 10, 2022
Merged
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 java.util.OptionalInt;

Expand Down Expand Up @@ -499,6 +500,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) &&
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.ObjLongConsumer;

Expand Down Expand Up @@ -240,4 +242,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 this.arrayOffset == other.arrayOffset &&
this.positionCount == other.positionCount &&
Arrays.equals(this.valueIsNull, other.valueIsNull) &&
Objects.equals(this.values, other.values) &&
Arrays.equals(this.offsets, other.offsets) &&
this.sizeInBytes == other.sizeInBytes &&
this.logicalSizeInBytes == other.logicalSizeInBytes &&
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.OptionalInt;
import java.util.function.ObjLongConsumer;
Expand Down Expand Up @@ -271,4 +273,31 @@ 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 this.arrayOffset == other.arrayOffset &&
this.positionCount == other.positionCount &&
Arrays.equals(this.valueIsNull, other.valueIsNull) &&
Arrays.equals(this.values, other.values) &&
this.retainedSizeInBytes == other.retainedSizeInBytes;
}

@Override
public int hashCode()
{
return Objects.hash(arrayOffset,
positionCount,
Arrays.hashCode(valueIsNull),
Arrays.hashCode(values),
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.OptionalInt;
import java.util.function.ObjLongConsumer;

Expand Down Expand Up @@ -671,4 +672,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 this.positionCount == other.positionCount &&
Objects.equals(this.dictionary, other.dictionary) &&
this.idsOffset == other.idsOffset &&
Arrays.equals(this.ids, other.ids) &&
this.retainedSizeInBytes == other.retainedSizeInBytes &&
this.sizeInBytes == other.sizeInBytes &&
this.logicalSizeInBytes == other.logicalSizeInBytes &&
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.OptionalInt;
import java.util.function.ObjLongConsumer;
Expand Down Expand Up @@ -366,4 +368,31 @@ public Block appendNull()
long[] newValues = ensureCapacity(values, (positionOffset + positionCount + 1) * 2, SMALL, PRESERVE);
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 this.positionOffset == other.positionOffset &&
this.positionCount == other.positionCount &&
Arrays.equals(this.valueIsNull, other.valueIsNull) &&
Arrays.equals(this.values, other.values) &&
this.retainedSizeInBytes == other.retainedSizeInBytes;
}

@Override
public int hashCode()
{
return Objects.hash(positionOffset,
positionCount,
Arrays.hashCode(valueIsNull),
Arrays.hashCode(values),
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.OptionalInt;
import java.util.function.ObjLongConsumer;
Expand Down Expand Up @@ -309,4 +311,31 @@ 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 this.arrayOffset == other.arrayOffset &&
this.positionCount == other.positionCount &&
Arrays.equals(this.valueIsNull, other.valueIsNull) &&
Arrays.equals(this.values, other.values) &&
this.retainedSizeInBytes == other.retainedSizeInBytes;
}

@Override
public int hashCode()
{
return Objects.hash(arrayOffset,
positionCount,
Arrays.hashCode(valueIsNull),
Arrays.hashCode(values),
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.ObjLongConsumer;

Expand Down Expand Up @@ -303,4 +305,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 this.startOffset == other.startOffset &&
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) &&
this.retainedSizeInBytesExceptHashtable == other.retainedSizeInBytesExceptHashtable &&
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.ObjLongConsumer;

Expand Down Expand Up @@ -268,4 +270,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 this.startOffset == other.startOffset &&
this.positionCount == other.positionCount &&
Arrays.equals(this.rowIsNull, other.rowIsNull) &&
Arrays.equals(this.fieldBlockOffsets, other.fieldBlockOffsets) &&
Arrays.equals(this.fieldBlocks, other.fieldBlocks) &&
this.sizeInBytes == other.sizeInBytes &&
this.logicalSizeInBytes == other.logicalSizeInBytes &&
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 @@ -21,6 +21,7 @@

import javax.annotation.Nullable;

import java.util.Objects;
import java.util.OptionalInt;
import java.util.function.ObjLongConsumer;

Expand Down Expand Up @@ -427,4 +428,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) &&
this.positionCount == other.positionCount;
}

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