Skip to content

Commit

Permalink
Fix postgres (#2899)
Browse files Browse the repository at this point in the history
  • Loading branch information
kumuwu authored Jun 11, 2024
1 parent 719dc48 commit 7265113
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ private static String performDedupAndVersioining(Datasets datasets, IngestMode i
ingestor.initDatasets(datasets);
ingestor.create();
ingestor.dedupAndVersion();
return ingestor.getIngestRunId();
return ingestor.getRunId();
}

private void verifyResults(String expectedDataPath, String [] schema, String ingestRunId, String orderByClause) throws IOException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,16 @@ public void verifyUnitemporalDeltaWithDeleteIndFilterDupsNoVersion(GeneratorResu
"AND ((sink.\"id\" = stage.\"id\") AND (sink.\"name\" = stage.\"name\"))))) AND " +
"(stage.\"delete_indicator\" NOT IN ('yes','1','true')))";

String expectedMetadataTableIngestQuery = "INSERT INTO batch_metadata " +
"(\"table_name\", \"table_batch_id\", \"batch_start_ts_utc\", \"batch_end_ts_utc\", \"batch_status\", \"ingest_request_id\", \"batch_statistics\") " +
"(SELECT 'main',(SELECT COALESCE(MAX(batch_metadata.\"table_batch_id\"),0)+1 FROM batch_metadata as batch_metadata " +
"WHERE UPPER(batch_metadata.\"table_name\") = 'MAIN'),'2000-01-01 00:00:00.000000',CURRENT_TIMESTAMP(),'DONE','123456789',TO_JSON('{BATCH_STATISTICS_PLACEHOLDER}'::json))";

Assertions.assertEquals(PostgresTestArtifacts.expectedMainTableBatchIdBasedCreateQuery, preActionsSql.get(0));
Assertions.assertEquals(PostgresTestArtifacts.expectedMetadataTableCreateQuery, preActionsSql.get(1));
Assertions.assertEquals(expectedMilestoneQuery, milestoningSql.get(0));
Assertions.assertEquals(expectedUpsertQuery, milestoningSql.get(1));
Assertions.assertEquals(getExpectedMetadataTableIngestQuery(), metadataIngestSql.get(0));
Assertions.assertEquals(expectedMetadataTableIngestQuery, metadataIngestSql.get(0));

String incomingRecordCount = "SELECT COUNT(*) as \"incomingRecordCount\" FROM \"mydb\".\"staging\" as stage";
String rowsUpdated = "SELECT COUNT(*) as \"rowsUpdated\" FROM \"mydb\".\"main\" as sink WHERE (sink.\"batch_id_out\" = (SELECT COALESCE(MAX(batch_metadata.\"table_batch_id\"),0)+1 FROM batch_metadata as batch_metadata WHERE UPPER(batch_metadata.\"table_name\") = 'MAIN')-1) AND (EXISTS (SELECT * FROM \"mydb\".\"main\" as sink2 WHERE ((sink2.\"id\" = sink.\"id\") AND (sink2.\"name\" = sink.\"name\")) AND (sink2.\"batch_id_in\" = (SELECT COALESCE(MAX(batch_metadata.\"table_batch_id\"),0)+1 FROM batch_metadata as batch_metadata WHERE UPPER(batch_metadata.\"table_name\") = 'MAIN'))))";
Expand Down

0 comments on commit 7265113

Please sign in to comment.