-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed Iceberg Delete as proof of concept. Fixed missing serialization…
… changes.
- Loading branch information
1 parent
b450564
commit 281756b
Showing
10 changed files
with
214 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
152 changes: 152 additions & 0 deletions
152
presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergDeleteTableHandle.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
/* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.facebook.presto.iceberg; | ||
|
||
import com.facebook.presto.hive.BaseHiveTableHandle; | ||
import com.facebook.presto.spi.ConnectorDeleteTableHandle; | ||
import com.facebook.presto.spi.SchemaTableName; | ||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import java.util.Map; | ||
import java.util.Objects; | ||
import java.util.Optional; | ||
import java.util.Set; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
public class IcebergDeleteTableHandle | ||
implements ConnectorDeleteTableHandle | ||
{ | ||
private final String schemaName; | ||
private final String tableName; | ||
private final IcebergTableName icebergTableName; | ||
private final boolean snapshotSpecified; | ||
private final Optional<String> outputPath; | ||
private final Optional<Map<String, String>> storageProperties; | ||
private final Optional<String> tableSchemaJson; | ||
private final Optional<Set<Integer>> partitionFieldIds; | ||
private final Optional<Set<Integer>> equalityFieldIds; | ||
|
||
@JsonCreator | ||
public IcebergDeleteTableHandle( | ||
@JsonProperty("schemaName") String schemaName, | ||
@JsonProperty("icebergTableName") IcebergTableName icebergTableName, | ||
@JsonProperty("snapshotSpecified") boolean snapshotSpecified, | ||
@JsonProperty("outputPath") Optional<String> outputPath, | ||
@JsonProperty("storageProperties") Optional<Map<String, String>> storageProperties, | ||
@JsonProperty("tableSchemaJson") Optional<String> tableSchemaJson, | ||
@JsonProperty("partitionFieldIds") Optional<Set<Integer>> partitionFieldIds, | ||
@JsonProperty("equalityFieldIds") Optional<Set<Integer>> equalityFieldIds) | ||
{ | ||
this.schemaName = requireNonNull(schemaName, "schemaName is null"); | ||
this.tableName = requireNonNull(icebergTableName.getTableName(), "tableName is null"); | ||
this.icebergTableName = requireNonNull(icebergTableName, "tableName is null"); | ||
this.snapshotSpecified = snapshotSpecified; | ||
this.outputPath = requireNonNull(outputPath, "filePrefix is null"); | ||
this.storageProperties = requireNonNull(storageProperties, "storageProperties is null"); | ||
this.tableSchemaJson = requireNonNull(tableSchemaJson, "tableSchemaJson is null"); | ||
this.partitionFieldIds = requireNonNull(partitionFieldIds, "partitionFieldIds is null"); | ||
this.equalityFieldIds = requireNonNull(equalityFieldIds, "equalityFieldIds is null"); | ||
} | ||
|
||
@JsonProperty | ||
public IcebergTableName getIcebergTableName() | ||
{ | ||
return icebergTableName; | ||
} | ||
|
||
@JsonProperty | ||
public boolean isSnapshotSpecified() | ||
{ | ||
return snapshotSpecified; | ||
} | ||
|
||
@JsonProperty | ||
public Optional<String> getTableSchemaJson() | ||
{ | ||
return tableSchemaJson; | ||
} | ||
|
||
@JsonProperty | ||
public Optional<String> getOutputPath() | ||
{ | ||
return outputPath; | ||
} | ||
|
||
@JsonProperty | ||
public Optional<Map<String, String>> getStorageProperties() | ||
{ | ||
return storageProperties; | ||
} | ||
|
||
@JsonProperty | ||
public Optional<Set<Integer>> getPartitionSpecId() | ||
{ | ||
return partitionFieldIds; | ||
} | ||
|
||
@JsonProperty | ||
public Optional<Set<Integer>> getEqualityFieldIds() | ||
{ | ||
return equalityFieldIds; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) | ||
{ | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
|
||
IcebergDeleteTableHandle that = (IcebergDeleteTableHandle) o; | ||
return Objects.equals(getSchemaName(), that.getSchemaName()) && | ||
Objects.equals(icebergTableName, that.icebergTableName) && | ||
snapshotSpecified == that.snapshotSpecified && | ||
Objects.equals(tableSchemaJson, that.tableSchemaJson) && | ||
Objects.equals(equalityFieldIds, that.equalityFieldIds); | ||
} | ||
|
||
@Override | ||
public int hashCode() | ||
{ | ||
return Objects.hash(getSchemaName(), icebergTableName, snapshotSpecified, tableSchemaJson, equalityFieldIds); | ||
} | ||
|
||
@Override | ||
public String toString() | ||
{ | ||
return icebergTableName.toString(); | ||
} | ||
|
||
@JsonProperty | ||
public String getSchemaName() | ||
{ | ||
return schemaName; | ||
} | ||
|
||
@JsonProperty | ||
public String getTableName() | ||
{ | ||
return tableName; | ||
} | ||
|
||
public SchemaTableName getSchemaTableName() | ||
{ | ||
return new SchemaTableName(schemaName, tableName); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
presto-main/src/main/java/com/facebook/presto/metadata/DeleteTableHandleJacksonModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.facebook.presto.metadata; | ||
|
||
import com.facebook.presto.spi.ConnectorDeleteTableHandle; | ||
import com.facebook.presto.spi.ConnectorInsertTableHandle; | ||
|
||
import javax.inject.Inject; | ||
|
||
public class DeleteTableHandleJacksonModule | ||
extends AbstractTypedJacksonModule<ConnectorDeleteTableHandle> | ||
{ | ||
@Inject | ||
public DeleteTableHandleJacksonModule(HandleResolver handleResolver) | ||
{ | ||
super(ConnectorDeleteTableHandle.class, | ||
handleResolver::getId, | ||
handleResolver::getDeleteTableHandleClass); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters