Skip to content

Commit

Permalink
Merge pull request #944 from blockscout/ll/bens-union-bug
Browse files Browse the repository at this point in the history
[BENS] fix: bug with union of several protocols
  • Loading branch information
sevenzing authored Jun 25, 2024
2 parents e5f030c + a452b5c commit a774737
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions blockscout-ens/bens-logic/src/subgraphs_reader/sql/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ pub fn union_domain_queries(
) -> Result<SelectStatement, anyhow::Error> {
let select_clause = Expr::cust(select_clause.unwrap_or("*"));
let sub_query = protocol_queries
.into_iter()
.map(|mut q| {
if let Some(pagination) = pagination {
pagination
.add_to_query(&mut q)
.context("adding pagination to query")?;
}
Ok(q.to_owned())
})
.collect::<Result<Vec<SelectStatement>, anyhow::Error>>()?
.into_iter()
.reduce(|mut acc, new| acc.union(UnionType::All, new).to_owned())
.expect("reduce from non empty iterator");
Expand Down

0 comments on commit a774737

Please sign in to comment.