Skip to content

Commit

Permalink
DBZ-7167 Provide a public API from the connector implementations to r…
Browse files Browse the repository at this point in the history
…etrieve the list of matching collections or tables based on the different include-/exclude lists
  • Loading branch information
harveyyue committed Dec 14, 2023
1 parent a5ee40a commit b51bec5
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import io.debezium.connector.common.RelationalBaseSourceConnector;
import io.debezium.connector.vitess.connection.VitessReplicationConnection;
import io.debezium.relational.RelationalDatabaseConnectorConfig;
import io.debezium.rest.model.DataCollection;
import io.debezium.relational.TableId;
import io.debezium.util.Strings;
import io.grpc.StatusRuntimeException;
import io.vitess.proto.Query;
Expand Down Expand Up @@ -393,13 +393,16 @@ protected Map<String, ConfigValue> validateAllFields(Configuration config) {
return results;
}

@SuppressWarnings("unchecked")
@Override
public List<DataCollection> getMatchingCollections(Configuration configuration) {
public List<TableId> getMatchingCollections(Configuration configuration) {
VitessConnectorConfig vitessConnectorConfig = new VitessConnectorConfig(configuration);
String keyspace = vitessConnectorConfig.getKeyspace();
List<String> allTables = getKeyspaceTables(vitessConnectorConfig);
List<String> includedTables = getIncludedTables(keyspace,
vitessConnectorConfig.tableIncludeList(), allTables);
return includedTables.stream().map(table -> new DataCollection(keyspace, table)).collect(Collectors.toList());
return includedTables.stream()
.map(table -> new TableId(keyspace, null, table))
.collect(Collectors.toList());
}
}

0 comments on commit b51bec5

Please sign in to comment.