Skip to content

Commit

Permalink
Refactor InventoryDumper (apache#32693)
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu authored Aug 26, 2024
1 parent 7fad404 commit 9eba36e
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ private void dumpPageByPage(final Connection connection) throws SQLException {
private List<Record> dumpPageByPage(final Connection connection, final InventoryQueryParameter queryParam, final AtomicLong rowCount) throws SQLException {
DatabaseType databaseType = dumperContext.getCommonContext().getDataSourceConfig().getDatabaseType();
int batchSize = dumperContext.getBatchSize();
try (PreparedStatement preparedStatement = JDBCStreamQueryBuilder.build(databaseType, connection, buildInventoryDumpPageByPageSQL(queryParam), batchSize)) {
try (PreparedStatement preparedStatement = JDBCStreamQueryBuilder.build(databaseType, connection, buildDumpPageByPageSQL(queryParam), batchSize)) {
runningStatement.set(preparedStatement);
setParameters(preparedStatement, queryParam, false);
try (ResultSet resultSet = preparedStatement.executeQuery()) {
Expand Down Expand Up @@ -246,7 +246,7 @@ private DataRecord loadDataRecord(final ResultSet resultSet, final ResultSetMeta
return result;
}

private String buildInventoryDumpPageByPageSQL(final InventoryQueryParameter queryParam) {
private String buildDumpPageByPageSQL(final InventoryQueryParameter queryParam) {
String schemaName = dumperContext.getCommonContext().getTableAndSchemaNameMapper().getSchemaName(dumperContext.getLogicTableName());
PipelineColumnMetaData firstColumn = dumperContext.getUniqueKeyColumns().get(0);
List<String> columnNames = dumperContext.getQueryColumnNames();
Expand Down Expand Up @@ -275,7 +275,7 @@ private void dumpWithStreamingQuery(final Connection connection) throws SQLExcep
if (null != dumperContext.getTransactionIsolation()) {
connection.setTransactionIsolation(dumperContext.getTransactionIsolation());
}
try (PreparedStatement preparedStatement = JDBCStreamQueryBuilder.build(databaseType, connection, buildInventoryDumpSQLWithStreamingQuery(), batchSize)) {
try (PreparedStatement preparedStatement = JDBCStreamQueryBuilder.build(databaseType, connection, buildDumpSQLWithStreamingQuery(), batchSize)) {
runningStatement.set(preparedStatement);
PrimaryKeyIngestPosition<?> primaryPosition = (PrimaryKeyIngestPosition<?>) dumperContext.getCommonContext().getPosition();
InventoryQueryParameter queryParam = InventoryQueryParameter.buildForRangeQuery(new QueryRange(primaryPosition.getBeginValue(), true, primaryPosition.getEndValue()));
Expand Down Expand Up @@ -310,7 +310,7 @@ private void dumpWithStreamingQuery(final Connection connection) throws SQLExcep
}
}

private String buildInventoryDumpSQLWithStreamingQuery() {
private String buildDumpSQLWithStreamingQuery() {
if (!Strings.isNullOrEmpty(dumperContext.getQuerySQL())) {
return dumperContext.getQuerySQL();
}
Expand Down

0 comments on commit 9eba36e

Please sign in to comment.