Skip to content
Merged
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 @@ -237,13 +237,31 @@ public boolean equals(Object o)
}
HiveTableHandle that = (HiveTableHandle) o;
return Objects.equals(schemaName, that.schemaName) &&
Objects.equals(tableName, that.tableName);
Objects.equals(tableName, that.tableName) &&
Objects.equals(tableParameters, that.tableParameters) &&
Objects.equals(partitionColumns, that.partitionColumns) &&
Objects.equals(partitions, that.partitions) &&
Objects.equals(compactEffectivePredicate, that.compactEffectivePredicate) &&
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Some of these fields (e.g., compactEffectivePredicate, enforcedPredicate) are not part of the identity of a hive "virtual" table. Handles should be equal to each other if they represent the same "object" (handles should be thought of like opaque IDs).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

If a handle represents table+predicate, it's no longer "the same" as handle representing a table.
Later on we will likely introduce table handles modelling a pushed down join.

Maybe we should remove equals from table handles? And treat them truly opaque?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@martint @electrum your feedback would be appreciated.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe we should remove equals from table handles? And treat them truly opaque?

They are opaque (from the point of view that the engine doesn't care about what's inside), but just like an id, you should be able to test id1 == id2 to see if they are the same. At some point we'll need that for some forms of memoization in the optimizer.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Okay, so they are opaque but need to implement equals().

  • we need document this requirement at SPI interface level
  • HiveTableHandle as it is today doesn't meet memo's requirements, since it ignores part of its (important) state in equals

if you agree, we should proceed with the PR, right?

Objects.equals(enforcedConstraint, that.enforcedConstraint) &&
Objects.equals(bucketHandle, that.bucketHandle) &&
Objects.equals(bucketFilter, that.bucketFilter) &&
Objects.equals(analyzePartitionValues, that.analyzePartitionValues);
}

@Override
public int hashCode()
{
return Objects.hash(schemaName, tableName);
return Objects.hash(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

do we need hashCode/equals at all for ConnectorTableHandle? If so then then they should be listed in SPI. How did you find that? Is there any Presto behavior change with this? Maybe we should remove these methods from Presto if they are not used?

schemaName,
tableName,
tableParameters,
partitionColumns,
partitions,
compactEffectivePredicate,
enforcedConstraint,
bucketHandle,
bucketFilter,
analyzePartitionValues);
}

@Override
Expand Down