-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Refactor Java Hive and Iceberg Connector for Prestissimo Iceberg Connector #21662
Refactor Java Hive and Iceberg Connector for Prestissimo Iceberg Connector #21662
Conversation
66cffe5
to
9e2428b
Compare
@@ -3666,6 +3667,7 @@ public TableLayoutFilterCoverage getTableLayoutFilterCoverage(ConnectorTableLayo | |||
{ | |||
HiveTableLayoutHandle tableHandle = (HiveTableLayoutHandle) connectorTableLayoutHandle; | |||
Set<String> relevantColumns = tableHandle.getPartitionColumns().stream() | |||
.map(HiveColumnHandle.class::cast) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to cast to HiveColumnHandle
Set<String> relevantColumns = tableHandle.getPartitionColumns().stream()
.map(BaseHiveColumnHandle::getName)
@@ -2565,6 +2565,7 @@ public boolean supportsMetadataDelete(ConnectorSession session, ConnectorTableHa | |||
.collect(toImmutableSet()); | |||
|
|||
Set<String> partitionColumnNames = layoutHandle.getPartitionColumns().stream() | |||
.map(HiveColumnHandle.class::cast) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to cast to HiveColumnHandle
Set<String> relevantColumns = tableHandle.getPartitionColumns().stream()
.map(BaseHiveColumnHandle::getName)
@@ -129,11 +129,16 @@ protected HiveTableLayoutHandle( | |||
boolean footerStatsUnreliable, | |||
Optional<HiveTableHandle> hiveTableHandle) | |||
{ | |||
super(domainPredicate, remainingPredicate, pushdownFilterEnabled, partitionColumnPredicate, partitions); | |||
super( | |||
partitionColumns.stream().map(BaseHiveColumnHandle.class::cast).collect(toList()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't usually do upcasts in the child classes. I think it's better to change the parameter partitionColumns to List<BaseColumnHandle>
@@ -333,7 +332,7 @@ public Builder builder() | |||
return new Builder() | |||
.setSchemaTableName(getSchemaTableName()) | |||
.setTablePath(getTablePath()) | |||
.setPartitionColumns(getPartitionColumns()) | |||
.setPartitionColumns(getPartitionColumns().stream().map(HiveColumnHandle.class::cast).collect(toList())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change
public Builder setPartitionColumns(List<HiveColumnHandle> partitionColumns)
to
public Builder setPartitionColumns(List<BaseHiveColumnHandle> partitionColumns)
and do downcast inside.
@@ -78,21 +79,20 @@ protected IcebergTableLayoutHandle( | |||
Optional<List<HivePartition>> partitions, | |||
IcebergTableHandle table) | |||
{ | |||
super(domainPredicate, remainingPredicate, pushdownFilterEnabled, partitionColumnPredicate, partitions); | |||
super( | |||
partitionColumns.stream().map(BaseHiveColumnHandle.class::cast).collect(toList()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
9e2428b
to
9c7bd6b
Compare
9c7bd6b
to
c67f699
Compare
@@ -80,12 +74,12 @@ public Optional<String> getTableSchemaJson() | |||
|
|||
public SchemaTableName getSchemaTableName() | |||
{ | |||
return new SchemaTableName(schemaName, tableName.getTableName()); | |||
return new SchemaTableName(getSchemaName(), getTableName()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getSchemaTableName() is already in BaseHiveTableHandle. Do we still need it here?
@@ -2633,7 +2633,7 @@ public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session | |||
new HiveTableLayoutHandle.Builder() | |||
.setSchemaTableName(handle.getSchemaTableName()) | |||
.setTablePath(table.getStorage().getLocation()) | |||
.setPartitionColumns(hivePartitionResult.getPartitionColumns()) | |||
.setPartitionColumns(ImmutableList.copyOf(hivePartitionResult.getPartitionColumns())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can make HivePartitionResult.partitionColumns
List<HiveColumnHandle>
, and make hivePartitionResult.getPartitionColumns()
return List<BaseHiveColumnHandle>
, and also make the constructor of HivePartitionResult take List<BaseHiveColumnHandle>
parameter.
@@ -89,7 +89,7 @@ public HiveTableLayoutHandle( | |||
this( | |||
schemaTableName, | |||
tablePath, | |||
partitionColumns, | |||
partitionColumns.stream().map(BaseHiveColumnHandle.class::cast).collect(toList()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change the constructor parameter partitionColumns to List<BaseHiveColumnHandle>
instead of doing upcasting here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed offline, we won't be able to make this change in the JSON constructor since we don't want the information to get lost while serializing.
c67f699
to
2cef922
Compare
presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergTableHandle.java
Outdated
Show resolved
Hide resolved
Refactor HiveTableHandle and IcebergTableHandle to extend BaseHiveTableHandle
2cef922
to
9be76e6
Compare
9be76e6
to
a3ebbb4
Compare
Description
Related to #21584
Motivation and Context
facebookincubator/velox#5977
Impact
N.A.
Test Plan
Contributor checklist
Release Notes
Please follow release notes guidelines and fill in the release notes below.