Skip to content

Commit 656d901

Browse files
committed
CDAP-17516 Dont populate total number of columns for table while listing the tables in the database.
1 parent e580b7c commit 656d901

2 files changed

Lines changed: 5 additions & 17 deletions

File tree

mysql-delta-plugins/src/main/java/io/cdap/delta/mysql/MySqlTableRegistry.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,11 @@ public TableList listTables() throws IOException {
5959
try (Connection connection = DriverManager.getConnection(getConnectionString(conf.getDatabase()),
6060
conf.getConnectionProperties())) {
6161
DatabaseMetaData dbMeta = connection.getMetaData();
62-
try (ResultSet tableResults = dbMeta.getTables(null, null, null, null)) {
62+
try (ResultSet tableResults = dbMeta.getTables(conf.getDatabase(), null, null, null)) {
6363
while (tableResults.next()) {
6464
String tableName = tableResults.getString(3);
65-
Optional<TableDetail.Builder> builder = getTableDetailBuilder(dbMeta, conf.getDatabase(), tableName);
66-
if (!builder.isPresent()) {
67-
// shouldn't happen
68-
continue;
69-
}
70-
TableDetail tableDetail = builder.get().build();
71-
tables.add(new TableSummary(conf.getDatabase(), tableName, tableDetail.getNumColumns(),
72-
tableDetail.getSchema()));
65+
// ignore the total number of columns for listing tables
66+
tables.add(new TableSummary(conf.getDatabase(), tableName, 0, null));
7367
}
7468
}
7569
return new TableList(tables);

sqlserver-delta-plugins/src/main/java/io/cdap/delta/sqlserver/SqlServerTableRegistry.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,8 @@ public TableList listTables() throws IOException {
8181
if (!tableNames.contains(tableName)) {
8282
continue;
8383
}
84-
Optional<TableDetail.Builder> builder = getTableDetailBuilder(dbMeta, config.getDatabase(), tableName);
85-
if (!builder.isPresent()) {
86-
// shouldn't happen
87-
continue;
88-
}
89-
TableDetail tableDetail = builder.get().build();
90-
tables.add(new TableSummary(config.getDatabase(), tableName, tableDetail.getNumColumns(),
91-
tableDetail.getSchema()));
84+
// ignore the total number of columns for listing tables
85+
tables.add(new TableSummary(config.getDatabase(), tableName, 0, null));
9286
}
9387
}
9488
return new TableList(tables);

0 commit comments

Comments
 (0)