-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Add table_supports_delta_delete property and support delta delete function for Raptor table #13248
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
Changes from all commits
62c2d2e
f54589a
8790164
7ecd86c
19e953e
7a9af6a
7cabcf9
c20a31c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,7 @@ | |
| import com.facebook.presto.raptor.metadata.Distribution; | ||
| import com.facebook.presto.raptor.metadata.ForMetadata; | ||
| import com.facebook.presto.raptor.metadata.TableColumn; | ||
| import com.facebook.presto.raptor.storage.StorageManagerConfig; | ||
| import com.facebook.presto.raptor.systemtables.ShardMetadataSystemTable; | ||
| import com.facebook.presto.raptor.systemtables.TableMetadataSystemTable; | ||
| import com.facebook.presto.raptor.systemtables.TableStatsSystemTable; | ||
|
|
@@ -33,6 +34,7 @@ | |
|
|
||
| import javax.inject.Singleton; | ||
|
|
||
| import static com.facebook.airlift.configuration.ConfigBinder.configBinder; | ||
| import static com.facebook.presto.raptor.metadata.SchemaDaoUtil.createTablesWithRetry; | ||
| import static com.google.inject.multibindings.Multibinder.newSetBinder; | ||
| import static java.util.Objects.requireNonNull; | ||
|
|
@@ -50,6 +52,8 @@ public RaptorModule(String connectorId) | |
| @Override | ||
| public void configure(Binder binder) | ||
| { | ||
| configBinder(binder).bindConfig(StorageManagerConfig.class); | ||
|
||
|
|
||
| binder.bind(RaptorConnectorId.class).toInstance(new RaptorConnectorId(connectorId)); | ||
| binder.bind(RaptorConnector.class).in(Scopes.SINGLETON); | ||
| binder.bind(RaptorMetadataFactory.class).in(Scopes.SINGLETON); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,16 +60,22 @@ public ConnectorPageSource createPageSource(ConnectorTransactionHandle transacti | |
| ReaderAttributes attributes = ReaderAttributes.from(session); | ||
| OptionalLong transactionId = raptorSplit.getTransactionId(); | ||
| Optional<Map<String, Type>> columnTypes = raptorSplit.getColumnTypes(); | ||
| boolean tableSupportsDeltaDelete = raptorSplit.isTableSupportsDeltaDelete(); | ||
|
|
||
| FileSystemContext context = new FileSystemContext(session); | ||
|
|
||
| Map<UUID, UUID> shardDeltaMap = raptorSplit.getShardDeltaMap(); | ||
| if (raptorSplit.getShardUuids().size() == 1) { | ||
| UUID shardUuid = raptorSplit.getShardUuids().iterator().next(); | ||
| return createPageSource(context, shardUuid, bucketNumber, columns, predicate, attributes, transactionId, columnTypes); | ||
| return createPageSource(context, shardUuid, | ||
kewang1024 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Optional.ofNullable(shardDeltaMap.get(shardUuid)), | ||
| tableSupportsDeltaDelete, bucketNumber, columns, predicate, attributes, transactionId, columnTypes); | ||
| } | ||
|
|
||
| Iterator<ConnectorPageSource> iterator = raptorSplit.getShardUuids().stream() | ||
| .map(shardUuid -> createPageSource(context, shardUuid, bucketNumber, columns, predicate, attributes, transactionId, columnTypes)) | ||
| .map(shardUuid -> createPageSource(context, shardUuid, | ||
kewang1024 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Optional.ofNullable(shardDeltaMap.get(shardUuid)), | ||
| tableSupportsDeltaDelete, bucketNumber, columns, predicate, attributes, transactionId, columnTypes)) | ||
| .iterator(); | ||
|
|
||
| return new ConcatPageSource(iterator); | ||
|
|
@@ -78,6 +84,8 @@ public ConnectorPageSource createPageSource(ConnectorTransactionHandle transacti | |
| private ConnectorPageSource createPageSource( | ||
| FileSystemContext context, | ||
| UUID shardUuid, | ||
| Optional<UUID> deltaShardUuid, | ||
kewang1024 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| boolean tableSupportsDeltaDelete, | ||
|
||
| OptionalInt bucketNumber, | ||
| List<ColumnHandle> columns, | ||
| TupleDomain<RaptorColumnHandle> predicate, | ||
|
|
@@ -89,6 +97,6 @@ private ConnectorPageSource createPageSource( | |
| List<Long> columnIds = columnHandles.stream().map(RaptorColumnHandle::getColumnId).collect(toList()); | ||
| List<Type> columnTypes = columnHandles.stream().map(RaptorColumnHandle::getColumnType).collect(toList()); | ||
|
|
||
| return storageManager.getPageSource(context, shardUuid, bucketNumber, columnIds, columnTypes, predicate, attributes, transactionId, allColumnTypes); | ||
| return storageManager.getPageSource(context, shardUuid, deltaShardUuid, tableSupportsDeltaDelete, bucketNumber, columnIds, columnTypes, predicate, attributes, transactionId, allColumnTypes); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,6 +38,8 @@ public class RaptorSplit | |
| { | ||
| private final String connectorId; | ||
| private final Set<UUID> shardUuids; | ||
| private final Map<UUID, UUID> shardDeltaMap; | ||
| private final boolean tableSupportsDeltaDelete; | ||
|
||
| private final OptionalInt bucketNumber; | ||
| private final List<HostAddress> addresses; | ||
| private final TupleDomain<RaptorColumnHandle> effectivePredicate; | ||
|
|
@@ -48,40 +50,48 @@ public class RaptorSplit | |
| public RaptorSplit( | ||
| @JsonProperty("connectorId") String connectorId, | ||
| @JsonProperty("shardUuids") Set<UUID> shardUuids, | ||
| @JsonProperty("shardDeltaMap") Map<UUID, UUID> shardDeltaMap, | ||
| @JsonProperty("tableSupportsDeltaDelete") boolean tableSupportsDeltaDelete, | ||
| @JsonProperty("bucketNumber") OptionalInt bucketNumber, | ||
| @JsonProperty("effectivePredicate") TupleDomain<RaptorColumnHandle> effectivePredicate, | ||
| @JsonProperty("transactionId") OptionalLong transactionId, | ||
| @JsonProperty("columnTypes") Optional<Map<String, Type>> columnTypes) | ||
| { | ||
| this(connectorId, shardUuids, bucketNumber, ImmutableList.of(), effectivePredicate, transactionId, columnTypes); | ||
| this(connectorId, shardUuids, shardDeltaMap, tableSupportsDeltaDelete, bucketNumber, ImmutableList.of(), effectivePredicate, transactionId, columnTypes); | ||
kewang1024 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| public RaptorSplit( | ||
| String connectorId, | ||
| UUID shardUuid, | ||
| Map<UUID, UUID> shardDeltaMap, | ||
| boolean tableSupportsDeltaDelete, | ||
| List<HostAddress> addresses, | ||
| TupleDomain<RaptorColumnHandle> effectivePredicate, | ||
| OptionalLong transactionId, | ||
| Optional<Map<String, Type>> columnTypes) | ||
| { | ||
| this(connectorId, ImmutableSet.of(shardUuid), OptionalInt.empty(), addresses, effectivePredicate, transactionId, columnTypes); | ||
| this(connectorId, ImmutableSet.of(shardUuid), shardDeltaMap, tableSupportsDeltaDelete, OptionalInt.empty(), addresses, effectivePredicate, transactionId, columnTypes); | ||
kewang1024 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| public RaptorSplit( | ||
| String connectorId, | ||
| Set<UUID> shardUuids, | ||
| Map<UUID, UUID> shardDeltaMap, | ||
| boolean tableSupportsDeltaDelete, | ||
| int bucketNumber, | ||
| HostAddress address, | ||
| TupleDomain<RaptorColumnHandle> effectivePredicate, | ||
| OptionalLong transactionId, | ||
| Optional<Map<String, Type>> columnTypes) | ||
| { | ||
| this(connectorId, shardUuids, OptionalInt.of(bucketNumber), ImmutableList.of(address), effectivePredicate, transactionId, columnTypes); | ||
| this(connectorId, shardUuids, shardDeltaMap, tableSupportsDeltaDelete, OptionalInt.of(bucketNumber), ImmutableList.of(address), effectivePredicate, transactionId, columnTypes); | ||
| } | ||
|
|
||
| private RaptorSplit( | ||
| String connectorId, | ||
| Set<UUID> shardUuids, | ||
| Map<UUID, UUID> shardDeltaMap, | ||
| boolean tableSupportsDeltaDelete, | ||
|
||
| OptionalInt bucketNumber, | ||
| List<HostAddress> addresses, | ||
| TupleDomain<RaptorColumnHandle> effectivePredicate, | ||
|
|
@@ -90,6 +100,8 @@ private RaptorSplit( | |
| { | ||
| this.connectorId = requireNonNull(connectorId, "connectorId is null"); | ||
| this.shardUuids = ImmutableSet.copyOf(requireNonNull(shardUuids, "shardUuid is null")); | ||
| this.shardDeltaMap = requireNonNull(shardDeltaMap, "shardUuid is null"); | ||
| this.tableSupportsDeltaDelete = requireNonNull(tableSupportsDeltaDelete, "tableSupportsDeltaDelete is null"); | ||
| this.bucketNumber = requireNonNull(bucketNumber, "bucketNumber is null"); | ||
| this.addresses = ImmutableList.copyOf(requireNonNull(addresses, "addresses is null")); | ||
| this.effectivePredicate = requireNonNull(effectivePredicate, "effectivePredicate is null"); | ||
|
|
@@ -121,6 +133,12 @@ public Set<UUID> getShardUuids() | |
| return shardUuids; | ||
| } | ||
|
|
||
| @JsonProperty | ||
| public Map<UUID, UUID> getShardDeltaMap() | ||
| { | ||
| return shardDeltaMap; | ||
| } | ||
|
|
||
| @JsonProperty | ||
| public OptionalInt getBucketNumber() | ||
| { | ||
|
|
@@ -145,6 +163,12 @@ public Optional<Map<String, Type>> getColumnTypes() | |
| return columnTypes; | ||
| } | ||
|
|
||
| @JsonProperty | ||
| public boolean isTableSupportsDeltaDelete() | ||
| { | ||
| return tableSupportsDeltaDelete; | ||
| } | ||
|
|
||
| @Override | ||
| public Object getInfo() | ||
| { | ||
|
|
@@ -156,6 +180,8 @@ public String toString() | |
| { | ||
| return toStringHelper(this) | ||
| .add("shardUuids", shardUuids) | ||
| .add("shardDeltaMap", shardDeltaMap.toString()) | ||
| .add("tableSupportsDeltaDelete", tableSupportsDeltaDelete) | ||
| .add("bucketNumber", bucketNumber.isPresent() ? bucketNumber.getAsInt() : null) | ||
| .add("hosts", addresses) | ||
| .omitNullValues() | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.