MCPcopy Create free account
hub / github.com/f0rr0/oliphaunt / parsed_numeric_updates

Function parsed_numeric_updates

xtask/src/main.rs:3264–3289  ·  view source on GitHub ↗
(limit: usize)

Source from the content-addressed store, hash-verified

3262}
3263
3264fn parsed_numeric_updates(limit: usize) -> Result<Vec<(i32, i32)>> {
3265 let sql = read_pglite_benchmark_sql("9")?;
3266 let mut updates = Vec::with_capacity(limit);
3267 for line in sql.lines() {
3268 let line = line.trim();
3269 let Some(rest) = line.strip_prefix("UPDATE t2 SET b=") else {
3270 continue;
3271 };
3272 let rest = rest
3273 .strip_suffix(';')
3274 .ok_or_else(|| anyhow!("numeric update line is missing semicolon: {line}"))?;
3275 let (value, lookup) = rest
3276 .split_once(" WHERE a=")
3277 .ok_or_else(|| anyhow!("numeric update line has unexpected shape: {line}"))?;
3278 updates.push((lookup.parse()?, value.parse()?));
3279 if updates.len() == limit {
3280 break;
3281 }
3282 }
3283 ensure!(
3284 updates.len() == limit,
3285 "benchmark9 only contained {} update rows; requested {limit}",
3286 updates.len()
3287 );
3288 Ok(updates)
3289}
3290
3291fn parsed_text_updates(limit: usize) -> Result<Vec<(i32, String)>> {
3292 let sql = read_pglite_benchmark_sql("10")?;

Callers 1

perf_prepared_updatesFunction · 0.85

Calls 4

pushMethod · 0.80
lenMethod · 0.80
parseMethod · 0.45

Tested by

no test coverage detected