Optimize activity report SQL

We only log FLOW-LOG-SIGNATURE-METADATA from one place- FlowRunner. As a
result, we can swap the generalized regex for a prefix-only regex, saving a
<strong>lot</strong> of processing for our epp query (which is the most
expensive of the bunch).

I've also changed the test dates from 2017-05 to 2017-06, allowing us to copy-paste
the test data into Bigquery to verify their function. The reason for 2017-06 in particular is because June was the first month that populated all the metadata necessary to generate these reports.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=165391715
This commit is contained in:
larryruili 2017-08-15 19:11:05 -07:00 committed by Ben McIlwain
parent 9e7c996081
commit 38abe9fa48
10 changed files with 33 additions and 29 deletions

View file

@ -29,7 +29,7 @@ public class ActivityReportingQueryBuilderTest {
private ActivityReportingQueryBuilder getQueryBuilder() {
ActivityReportingQueryBuilder queryBuilder = new ActivityReportingQueryBuilder();
queryBuilder.yearMonth = "2017-05";
queryBuilder.yearMonth = "2017-06";
queryBuilder.projectId = "domain-registry-alpha";
return queryBuilder;
}
@ -40,7 +40,7 @@ public class ActivityReportingQueryBuilderTest {
assertThat(queryBuilder.getActivityReportQuery())
.isEqualTo(
"#standardSQL\nSELECT * FROM "
+ "`domain-registry-alpha.icann_reporting.activity_report_aggregation_201705`");
+ "`domain-registry-alpha.icann_reporting.activity_report_aggregation_201706`");
}
@Test
@ -59,7 +59,7 @@ public class ActivityReportingQueryBuilderTest {
for (String queryName : queryNames) {
String testFilename = String.format("%s_test.sql", queryName);
testQueryBuilder.put(
String.format("%s_201705", queryName), ReportingTestData.getString(testFilename));
String.format("%s_201706", queryName), ReportingTestData.getString(testFilename));
}
ImmutableMap<String, String> expectedQueries = testQueryBuilder.build();
ImmutableMap<String, String> actualQueries = queryBuilder.getViewQueryMap();