Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make QueryResult::toString const #5013

Merged
merged 1 commit into from
Mar 14, 2025
Merged

Make QueryResult::toString const #5013

merged 1 commit into from
Mar 14, 2025

Conversation

benjaminwinger
Copy link
Collaborator

Having toString mutate the query result means that in rust we can't use the Display trait (safely anyway). I think it's also somewhat unintuitive for it to mutate itself in this case.

I'd actually looked at this a while ago but had been attempting to separate the iterator from the QueryResult entirely (e.g. have a QueryResult::iter method that produces an iterator which has getNext/hasNext functions instead of having that be directly on the QueryResult, but that affected a lot of stuff so I never finished it.
Instead, I've made it so that QueryResult::toString uses its own FlatTupleIterator/FlatTuple and avoids mutating the one from the QueryResult.

There will be a subtle difference in behaviour, as you can no longer start consuming the results and then use toString to print the remaining results, but hopefully that's not behaviour anyone was relying on.

Copy link

codecov bot commented Mar 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.91%. Comparing base (77dff7f) to head (1193120).
Report is 15 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5013      +/-   ##
==========================================
+ Coverage   87.88%   87.91%   +0.03%     
==========================================
  Files        1422     1427       +5     
  Lines       64377    64557     +180     
  Branches     7560     7576      +16     
==========================================
+ Hits        56576    56755     +179     
- Misses       7772     7773       +1     
  Partials       29       29              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@benjaminwinger benjaminwinger force-pushed the const-to-string branch 2 times, most recently from f7e918f to a1c7ffa Compare March 7, 2025 23:15
Copy link

github-actions bot commented Mar 7, 2025

Benchmark Result

Master commit hash: 10a65b0486cba91c2e66d919c7570d87b3eecdf9
Branch commit hash: 31f7bfa536e893f7c38523cb3c496c48da85c230

Query Group Query Name Mean Time - Commit (ms) Mean Time - Master (ms) Diff
aggregation q24 728.23 729.98 -1.75 (-0.24%)
aggregation q28 6585.13 6561.92 23.21 (0.35%)
filter q14 126.70 125.18 1.52 (1.22%)
filter q15 130.18 126.24 3.95 (3.13%)
filter q16 342.98 339.50 3.48 (1.02%)
filter q17 448.30 446.60 1.71 (0.38%)
filter q18 2000.76 1990.96 9.80 (0.49%)
filter zonemap-node 89.25 90.79 -1.54 (-1.69%)
filter zonemap-node-lhs-cast 90.24 89.49 0.75 (0.83%)
filter zonemap-node-null 89.12 89.50 -0.37 (-0.42%)
filter zonemap-rel 5580.88 5764.45 -183.57 (-3.18%)
fixed_size_expr_evaluator q07 689.55 689.13 0.41 (0.06%)
fixed_size_expr_evaluator q08 975.46 968.61 6.85 (0.71%)
fixed_size_expr_evaluator q09 976.24 966.25 9.99 (1.03%)
fixed_size_expr_evaluator q10 262.20 260.67 1.53 (0.59%)
fixed_size_expr_evaluator q11 263.76 260.24 3.52 (1.35%)
fixed_size_expr_evaluator q12 239.52 241.60 -2.08 (-0.86%)
fixed_size_expr_evaluator q13 1562.88 1564.85 -1.98 (-0.13%)
fixed_size_seq_scan q23 122.88 115.79 7.09 (6.13%)
join q29 770.85 750.44 20.41 (2.72%)
join q30 1682.39 1603.80 78.59 (4.90%)
join q31 6.64 6.66 -0.03 (-0.39%)
join SelectiveTwoHopJoin 45.89 51.08 -5.18 (-10.15%)
ldbc_snb_ic q35 9.90 10.23 -0.33 (-3.24%)
ldbc_snb_ic q36 97.46 100.49 -3.04 (-3.02%)
ldbc_snb_is q32 4.64 6.82 -2.18 (-31.98%)
ldbc_snb_is q33 12.47 10.50 1.97 (18.81%)
ldbc_snb_is q34 1.22 1.25 -0.02 (-1.69%)
multi-rel multi-rel-large-scan 1411.87 1413.33 -1.46 (-0.10%)
multi-rel multi-rel-lookup 9.00 11.47 -2.46 (-21.47%)
multi-rel multi-rel-small-scan 197.80 183.55 14.25 (7.77%)
order_by q25 129.28 127.58 1.70 (1.33%)
order_by q26 453.76 449.13 4.63 (1.03%)
order_by q27 1381.46 1379.84 1.61 (0.12%)
recursive_join recursive-join-bidirection 293.14 286.81 6.32 (2.20%)
recursive_join recursive-join-dense 7133.07 7166.05 -32.98 (-0.46%)
recursive_join recursive-join-path 23222.09 23199.43 22.66 (0.10%)
recursive_join recursive-join-sparse 634.66 626.02 8.63 (1.38%)
recursive_join recursive-join-trail 7060.71 7091.45 -30.74 (-0.43%)
scan_after_filter q01 169.79 175.24 -5.45 (-3.11%)
scan_after_filter q02 154.66 156.08 -1.42 (-0.91%)
shortest_path_ldbc100 q37 96.42 92.77 3.65 (3.93%)
shortest_path_ldbc100 q38 363.55 315.75 47.80 (15.14%)
shortest_path_ldbc100 q39 57.37 64.18 -6.82 (-10.62%)
shortest_path_ldbc100 q40 352.01 421.73 -69.73 (-16.53%)
var_size_expr_evaluator q03 2086.50 2074.65 11.84 (0.57%)
var_size_expr_evaluator q04 2316.93 2311.98 4.95 (0.21%)
var_size_expr_evaluator q05 2587.01 2670.57 -83.56 (-3.13%)
var_size_expr_evaluator q06 1378.96 1373.09 5.87 (0.43%)
var_size_seq_scan q19 1424.83 1431.12 -6.29 (-0.44%)
var_size_seq_scan q20 2571.37 2735.38 -164.01 (-6.00%)
var_size_seq_scan q21 2252.57 2277.93 -25.36 (-1.11%)
var_size_seq_scan q22 123.90 125.55 -1.65 (-1.32%)

@benjaminwinger benjaminwinger force-pushed the const-to-string branch 3 times, most recently from 9c33b9a to b27c401 Compare March 11, 2025 17:05
Copy link

Benchmark Result

Master commit hash: d45b10096fe4088ded5726b5d5607f8f29af891a
Branch commit hash: 95ef5f9765c4afc253dbaa11cee98e98786b1510

Query Group Query Name Mean Time - Commit (ms) Mean Time - Master (ms) Diff
aggregation q24 718.90 747.87 -28.96 (-3.87%)
aggregation q28 6584.51 6618.13 -33.62 (-0.51%)
filter q14 119.93 145.28 -25.35 (-17.45%)
filter q15 118.67 145.28 -26.61 (-18.32%)
filter q16 337.09 368.99 -31.90 (-8.64%)
filter q17 437.34 463.15 -25.81 (-5.57%)
filter q18 1994.62 1989.32 5.30 (0.27%)
filter zonemap-node 80.42 105.27 -24.85 (-23.60%)
filter zonemap-node-lhs-cast 81.94 104.70 -22.77 (-21.75%)
filter zonemap-node-null 83.03 104.52 -21.49 (-20.56%)
filter zonemap-rel 5704.96 5701.98 2.98 (0.05%)
fixed_size_expr_evaluator q07 672.55 708.50 -35.95 (-5.07%)
fixed_size_expr_evaluator q08 956.82 993.72 -36.90 (-3.71%)
fixed_size_expr_evaluator q09 961.08 997.45 -36.37 (-3.65%)
fixed_size_expr_evaluator q10 246.65 283.05 -36.40 (-12.86%)
fixed_size_expr_evaluator q11 246.88 283.75 -36.88 (-13.00%)
fixed_size_expr_evaluator q12 224.83 262.03 -37.19 (-14.19%)
fixed_size_expr_evaluator q13 1552.34 1583.36 -31.02 (-1.96%)
fixed_size_seq_scan q23 100.12 132.67 -32.54 (-24.53%)
join q29 740.26 769.03 -28.78 (-3.74%)
join q30 1533.63 1678.25 -144.62 (-8.62%)
join q31 4.98 6.79 -1.81 (-26.70%)
join SelectiveTwoHopJoin 41.40 43.39 -1.99 (-4.59%)
ldbc_snb_ic q35 10.37 8.76 1.61 (18.40%)
ldbc_snb_ic q36 100.34 99.65 0.70 (0.70%)
ldbc_snb_is q32 5.37 6.70 -1.33 (-19.87%)
ldbc_snb_is q33 14.21 13.91 0.30 (2.16%)
ldbc_snb_is q34 1.29 1.21 0.08 (6.79%)
multi-rel multi-rel-large-scan 1704.80 1754.12 -49.32 (-2.81%)
multi-rel multi-rel-lookup 10.83 10.58 0.26 (2.46%)
multi-rel multi-rel-small-scan 199.76 206.64 -6.88 (-3.33%)
order_by q25 125.38 148.19 -22.81 (-15.39%)
order_by q26 444.59 472.21 -27.62 (-5.85%)
order_by q27 1375.39 1416.71 -41.32 (-2.92%)
recursive_join recursive-join-bidirection 296.56 289.72 6.84 (2.36%)
recursive_join recursive-join-dense 5043.31 5068.26 -24.95 (-0.49%)
recursive_join recursive-join-path 22652.71 22563.66 89.05 (0.39%)
recursive_join recursive-join-sparse 633.63 626.19 7.44 (1.19%)
recursive_join recursive-join-trail 5527.51 5567.59 -40.08 (-0.72%)
scan_after_filter q01 160.47 187.83 -27.36 (-14.57%)
scan_after_filter q02 148.30 175.48 -27.18 (-15.49%)
shortest_path_ldbc100 q37 93.97 89.56 4.41 (4.93%)
shortest_path_ldbc100 q38 320.02 322.29 -2.26 (-0.70%)
shortest_path_ldbc100 q39 58.20 59.74 -1.54 (-2.58%)
shortest_path_ldbc100 q40 397.61 409.23 -11.62 (-2.84%)
var_size_expr_evaluator q03 2123.68 2109.08 14.60 (0.69%)
var_size_expr_evaluator q04 2281.91 2310.33 -28.42 (-1.23%)
var_size_expr_evaluator q05 2716.50 2686.91 29.59 (1.10%)
var_size_expr_evaluator q06 1337.31 1371.76 -34.45 (-2.51%)
var_size_seq_scan q19 1419.52 1445.00 -25.49 (-1.76%)
var_size_seq_scan q20 2702.13 2700.86 1.27 (0.05%)
var_size_seq_scan q21 2233.31 2258.10 -24.79 (-1.10%)
var_size_seq_scan q22 126.55 128.70 -2.15 (-1.67%)

@andyfengHKU andyfengHKU merged commit 1068d07 into master Mar 14, 2025
28 checks passed
@andyfengHKU andyfengHKU deleted the const-to-string branch March 14, 2025 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants