SPARQL: Use empty group by instead of the "1" constant

pull/171/head
Tpt 3 years ago
parent 067109e036
commit 9da605f84f
  1. 5
      spargebra/src/algebra.rs
  2. 13
      spargebra/src/parser.rs

@ -736,10 +736,13 @@ impl fmt::Display for GraphPattern {
for b in by {
write!(f, " {}", b)?;
}
write!(f, " WHERE {{ {} }} GROUP BY", inner)?;
write!(f, " WHERE {{ {} }}", inner)?;
if !by.is_empty() {
write!(f, " GROUP BY")?;
for v in by {
write!(f, " {}", v)?;
}
}
write!(f, "}}")
}
p => write!(

@ -451,18 +451,7 @@ fn build_select(
//GROUP BY
let aggregates = state.aggregates.pop().unwrap_or_else(Vec::default);
if group.is_none() && !aggregates.is_empty() {
let const_variable = variable();
group = Some((
vec![const_variable.clone()],
vec![(
Literal::Typed {
value: "1".into(),
datatype: iri("http://www.w3.org/2001/XMLSchema#integer"),
}
.into(),
const_variable,
)],
));
group = Some((vec![], vec![]));
}
if let Some((clauses, binds)) = group {

Loading…
Cancel
Save