Skip to content

Commit

Permalink
Add more todo comments on pipeline module (apache#32738)
Browse files Browse the repository at this point in the history
* Add more todo comments on pipeline module

* Add more todo comments on pipeline module
  • Loading branch information
terrymanu authored Aug 30, 2024
1 parent 90b1f6b commit 63bec32
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public Collection<String> buildCreateTableSQLs(final DataSource dataSource, fina
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(String.format("SELECT * FROM pg_get_tabledef('%s.%s')", schemaName, tableName))) {
if (resultSet.next()) {
// TODO use ";" to split is not always correct
// TODO use ";" to split is not always correct if return value's comments contains ";"
return Arrays.asList(resultSet.getString("pg_get_tabledef").split(";"));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,12 @@ public Optional<String> buildEstimatedCountSQL(final String qualifiedTableName)
return Optional.of(String.format("SELECT reltuples::integer FROM pg_class WHERE oid='%s'::regclass::oid;", qualifiedTableName));
}

// TODO support partitions etc.
// TODO support partitions etc. If user use partition table, after sharding, the partition definition will not be needed. So we need to remove it after supported.
@Override
public Optional<String> buildCRC32SQL(final String qualifiedTableName, final String columnName) {
return Optional.of(String.format("SELECT pg_catalog.pg_checksum_table('%s', true)", qualifiedTableName));
}

@Override
public Collection<String> buildCreateTableSQLs(final DataSource dataSource, final String schemaName, final String tableName) throws SQLException {
try (Connection connection = dataSource.getConnection()) {
Expand All @@ -81,7 +86,7 @@ public Collection<String> buildCreateTableSQLs(final DataSource dataSource, fina
Map<String, Object> materials = loadMaterials(tableName, schemaName, connection, majorVersion, minorVersion);
String tableSQL = generateCreateTableSQL(majorVersion, minorVersion, materials);
String indexSQL = generateCreateIndexSQL(connection, majorVersion, minorVersion, materials);
// TODO use ";" to split is not always correct
// TODO use ";" to split is not always correct if return value's comments contains ";"
return Arrays.asList((tableSQL + System.lineSeparator() + indexSQL).trim().split(";"));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ public void commit(final String jobId) {
}

private void refreshTableMetadata(final String jobId, final String databaseName) {
// TODO use origin database name now, wait reloadDatabaseMetaData fix case-sensitive problem
// TODO use origin database name for now. It can be reduce metadata refresh scope after reloadDatabaseMetaData case-sensitive problem fixed.
ContextManager contextManager = PipelineContextManager.getContext(PipelineJobIdUtils.parseContextKey(jobId)).getContextManager();
ShardingSphereDatabase database = contextManager.getMetaDataContexts().getMetaData().getDatabase(databaseName);
contextManager.getMetaDataContextManager().refreshTableMetaData(database);
Expand Down

0 comments on commit 63bec32

Please sign in to comment.