in spanner-data-validator-java/src/main/java/com/google/migration/dofns/CustomTransformationDoFn.java [136:161]
private MigrationTransformationResponse getCustomTransformationResponse(
Map<String, Object> sourceRecord, String tableName, String shardId)
throws InvalidTransformationException {
org.joda.time.Instant startTimestamp = org.joda.time.Instant.now();
MigrationTransformationRequest migrationTransformationRequest =
new MigrationTransformationRequest(tableName, sourceRecord, shardId, "INSERT");
LOG.debug(
"using migration transformation request {} for table {}",
migrationTransformationRequest,
tableName);
MigrationTransformationResponse migrationTransformationResponse;
try {
migrationTransformationResponse =
customTransformer.toSpannerRow(migrationTransformationRequest);
} finally {
org.joda.time.Instant endTimestamp = org.joda.time.Instant.now();
applyCustomTransformationResponseTimeMetric.update(
new Duration(startTimestamp, endTimestamp).getMillis());
}
LOG.debug(
"Got migration transformation response {} for table {}",
migrationTransformationResponse,
tableName);
return migrationTransformationResponse;
}