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

Fix sample stats for step invariant and subquery #506

Merged
merged 3 commits into from
Jan 10, 2025

Conversation

harry671003
Copy link
Contributor

@harry671003 harry671003 commented Jan 4, 2025

Changes

  • The samples were not counted correctly for step invariant operator
  • Also added the total samples and total samples per step comparison in fuzz tests

Note

Fuzzing did uncover a case which cannot be addressed without an upstream change

engine/explain.go Outdated Show resolved Hide resolved
engine/enginefuzz_test.go Outdated Show resolved Hide resolved
execution/model/operator.go Outdated Show resolved Hide resolved
@harry671003 harry671003 force-pushed the fuzz_query_stats branch 2 times, most recently from c40ab9b to f86337d Compare January 6, 2025 04:52
@harry671003 harry671003 changed the title Fix sample stats for step invariant Fix sample stats for step invariant and subquery Jan 6, 2025
@harry671003 harry671003 force-pushed the fuzz_query_stats branch 2 times, most recently from ff6d901 to 7263b8d Compare January 6, 2025 07:46
if a.OperatorTelemetry.StepInvariant() {
// Children of step invariant operator outputs one step, but they should be counted towards all the steps.
for i := 0; i < len(a.totalSamplesPerStep); i++ {
childSamples := child.TotalSamples()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to recalculate this for each loop iteration?

I also wonder if we can modify the implementation of the step invariant analysis to fit into the existing algorithm instead of tweaking the algorithm to specially handle the step invariant case.

Copy link
Contributor Author

@harry671003 harry671003 Jan 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also wonder if we can modify the implementation of the step invariant analysis

The other option was to IncrementSamples() in StepInvariant operator and skip counting samples from its children. I initially preferred this option, but ran into problem with pi(). The stepInvariant operator doesn't know if these samples are real samples or synthetic samples.

Signed-off-by: 🌲 Harry 🌊 John 🏔 <[email protected]>
@harry671003 harry671003 force-pushed the fuzz_query_stats branch 2 times, most recently from 1d2c3de to 1f7de1f Compare January 7, 2025 16:43
Signed-off-by: 🌲 Harry 🌊 John 🏔 <[email protected]>
Signed-off-by: 🌲 Harry 🌊 John 🏔 <[email protected]>
@yeya24 yeya24 merged commit 14f9955 into thanos-io:main Jan 10, 2025
7 checks passed
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.

4 participants