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

execgen: some small improvements #49727

Merged
merged 2 commits into from
May 30, 2020

Conversation

jordanlewis
Copy link
Member

  • Use imports to avoid having to precisely specify template imports
  • Use strings.Replacer to streamline some code

@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Member

@yuzefovich yuzefovich left a comment

Choose a reason for hiding this comment

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

Nice! :lgtm:

Reviewed 22 of 22 files at r1, 24 of 24 files at r2.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @jordanlewis)


pkg/col/coldata/vec_tmpl.go, line 38 at r1 (raw file):

// Dummy import to pull in "typeconv" package.
var _ = typeconv.DatumVecCanonicalTypeFamily

This can also be removed I think (and in a few other templates where we have this line).


pkg/sql/colexec/execgen/cmd/execgen/distinct_gen.go, line 32 at r2 (raw file):

	r := strings.NewReplacer(
		"_CANONICAL_TYPE_FAMILY", "{{.CanonicalTypeFamilyStr}}",
		"_CANONICAL_TYPE_FAMILYY", "{{.CanonicalTypeFamilyStr}}",

An artifact.


pkg/sql/colexec/execgen/cmd/execgen/vec_comparators_gen.go, line 31 at r2 (raw file):

	r := strings.NewReplacer(
		"_CANONICAL_TYPE_FAMILY", "{{.CanonicalTypeFamilyStr}}",
		"_TYPE_WIDTH", "{{.Width}}{{if eq .Width -1}}: default{{end}}",

nit: this could be "_TYPE_WIDTH", typeWidthReplacement,.

Remove the Dummy import plague on the template files by using the
`goimports` infrastructure to make the .eg.go files get their imports
at generation time.

Release note: None
instead of repeated strings.ReplaceAll

Release note: None
@jordanlewis
Copy link
Member Author

bors r+

Copy link
Member Author

@jordanlewis jordanlewis left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @yuzefovich)


pkg/col/coldata/vec_tmpl.go, line 38 at r1 (raw file):

Previously, yuzefovich wrote…

This can also be removed I think (and in a few other templates where we have this line).

Done.


pkg/sql/colexec/execgen/cmd/execgen/distinct_gen.go, line 32 at r2 (raw file):

Previously, yuzefovich wrote…

An artifact.

Done.

@craig
Copy link
Contributor

craig bot commented May 30, 2020

Build failed

@jordanlewis
Copy link
Member Author

bors r+

@craig
Copy link
Contributor

craig bot commented May 30, 2020

Build succeeded

@craig craig bot merged commit 77fa68e into cockroachdb:master May 30, 2020
@jordanlewis jordanlewis deleted the imports-and-replacer branch June 11, 2020 02:54
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