Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Commit

Permalink
Merge pull request #27 from pagopa/bugfix/interpolation-large-graph
Browse files Browse the repository at this point in the history
Fix interpolation for larger graph
  • Loading branch information
galales authored Oct 16, 2023
2 parents 6904129 + 2eee62f commit 65b43fc
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ public List<StatisticContent> findStatistics(Long eserviceRecordId, Integer poll
+ "SELECT binned_timestamp, status, avg_response_time "
+ "FROM "
//this select with the where condition on seqnum deletes all the duplicates time that will be created with the approximation keeping the lowest time
+ "(SELECT * , row_number() over (partition by binned_timestamp order by binned_timestamp desc) as seqnum FROM "
+ "(SELECT eservice_record_id ,status,bin(time,"+ (pollingFrequency * months) +"m) as binned_timestamp, cast(avg(response_time) as int) as avg_response_time "
+ "(SELECT * , row_number() over (partition by binned_timestamp order by binned_timestamp desc,num_status desc) as seqnum FROM "
+ "(SELECT eservice_record_id ,status,bin(time,"+ (pollingFrequency * months) +"m) as binned_timestamp, cast(avg(response_time) as int) as avg_response_time,count(status) as num_status "
+ "FROM " + database + "." + table + " "
+ "WHERE time between "
+ (Objects.nonNull(startDate) ? "'" + startDate.format(DateTimeFormatter.ofPattern(TIME_FORMAT)) + "' " : "ago(1d) ")
Expand Down

0 comments on commit 65b43fc

Please sign in to comment.