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(gen/tables): passing seed to tables generator #4866

Merged
merged 2 commits into from
Jun 13, 2022

Conversation

skartikey
Copy link
Contributor

Adding seed to tables generator to get the very same sequence each time(helpful in writing test)
at the moment the seed defaults to the current time, which generates a different sequence each time.

useful in #4307

Done checklist

  • docs/SPEC.md updated
  • Test cases written

@skartikey skartikey requested review from a team as code owners June 10, 2022 14:41
@skartikey skartikey requested review from Marwes and lwandzura and removed request for a team June 10, 2022 14:41
@skartikey skartikey closed this Jun 10, 2022
@skartikey skartikey force-pushed the skartikey-flux-gen-table branch from 35bab66 to 9e77d56 Compare June 10, 2022 14:59
Adding seed to tables generator to get the very same sequence each time(helpful in writing test)
at the moment the seed defaults to the current time, which generates a different sequence each time.

useful in #4307
@skartikey skartikey reopened this Jun 10, 2022
@@ -26,6 +26,7 @@ type TablesOpSpec struct {
N int `json:"n"`
Tags []Tag `json:"tags,omitempty"`
Nulls float64 `json:"nulls,omitempty"`
Seed int64 `json:"Seed,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you will want this to be a pointer, otherwise omitting the seed parameter default to using 0 as the seed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for catching that @Marwes

@@ -116,6 +123,7 @@ func newTablesProcedure(qs flux.OperationSpec, pa plan.Administration) (plan.Pro
schema := gen.Schema{
NumPoints: spec.N,
Nulls: spec.Nulls,
Seed: &spec.Seed,
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be nil if the seed is not specified in the function call

@lwandzura lwandzura requested review from sanderson and removed request for lwandzura June 10, 2022 15:32
@skartikey skartikey requested a review from Marwes June 10, 2022 17:32
@skartikey skartikey merged commit 2ceafc4 into master Jun 13, 2022
@skartikey skartikey deleted the skartikey-flux-gen-table branch June 13, 2022 09:24
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.

3 participants