Skip to content
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

Patch/2.39.3.1 15645 15661 #15721

Merged
merged 2 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -176,30 +176,32 @@ private void populateTableInternal(AnalyticsTablePartition partition, String sql
List<String> columnNames =
getDimensionColumns().stream().map(AnalyticsTableColumn::getName).collect(toList());

MappingBatchHandler batchHandler =
try (MappingBatchHandler batchHandler =
MappingBatchHandler.builder()
.jdbcConfiguration(jdbcConfiguration)
.tableName(partition.getTempTableName())
.columns(columnNames)
.build();

batchHandler.init();

JdbcOwnershipWriter writer = JdbcOwnershipWriter.getInstance(batchHandler);
AtomicInteger queryRowCount = new AtomicInteger();

jdbcTemplate.query(
sql,
resultSet -> {
writer.write(getRowMap(columnNames, resultSet));
queryRowCount.getAndIncrement();
});

log.info(
"OwnershipAnalytics query row count was {} for {}",
queryRowCount,
partition.getTempTableName());
batchHandler.flush();
.build()) {
batchHandler.init();

JdbcOwnershipWriter writer = JdbcOwnershipWriter.getInstance(batchHandler);
AtomicInteger queryRowCount = new AtomicInteger();

jdbcTemplate.query(
sql,
resultSet -> {
writer.write(getRowMap(columnNames, resultSet));
queryRowCount.getAndIncrement();
});

log.info(
"OwnershipAnalytics query row count was {} for {}",
queryRowCount,
partition.getTempTableName());
batchHandler.flush();
} catch (Exception ex) {
log.error("Failed to alter table ownership: ", ex);
}
}

private String getInputSql(Program program) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import org.hisp.dhis.common.IdSchemes;
import org.hisp.dhis.dxf2.common.ImportOptions;
import org.hisp.dhis.dxf2.importsummary.ImportSummary;
import org.hisp.dhis.scheduling.JobConfiguration;

/**
* Import/export service for {@link CompleteDataSetRegistration data set completion registrations}.
Expand Down Expand Up @@ -109,17 +108,6 @@ void writeCompleteDataSetRegistrationsJson(
*/
ImportSummary saveCompleteDataSetRegistrationsXml(InputStream in, ImportOptions importOptions);

/**
* Imports {@link CompleteDataSetRegistrations} from an XML payload.
*
* @param in the stream providing the XML payload.
* @param importOptions the options for the import.
* @param jobId the task (optional).
* @return a summary of the import process.
*/
ImportSummary saveCompleteDataSetRegistrationsXml(
InputStream in, ImportOptions importOptions, JobConfiguration jobId);

/**
* Imports {@link CompleteDataSetRegistrations} from a JSON payload.
*
Expand All @@ -129,22 +117,10 @@ ImportSummary saveCompleteDataSetRegistrationsXml(
*/
ImportSummary saveCompleteDataSetRegistrationsJson(InputStream in, ImportOptions importOptions);

/**
* Imports {@link CompleteDataSetRegistrations} from a JSON payload.
*
* @param in the stream providing the XML payload.
* @param importOptions the options for the import.
* @param jobId the task (optional).
* @return a summary of the import process.
*/
ImportSummary saveCompleteDataSetRegistrationsJson(
InputStream in, ImportOptions importOptions, JobConfiguration jobId);

/**
* Validates the given {@link ExportParams}.
*
* @param params the export parameters.
* @throws IllegalQueryException if validation failed.
*/
void validate(ExportParams params);
}
Loading