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

bazel: generate colexecagg .eg.go files within the sandbox #58479

Merged
merged 1 commit into from
Jan 6, 2021

Conversation

alan-mas
Copy link
Contributor

@alan-mas alan-mas commented Jan 6, 2021

Fixes #58421. For the go dependency changes, we've applied the same
treatment as 52c5f51.

Release note: None

@blathers-crl
Copy link

blathers-crl bot commented Jan 6, 2021

Thank you for contributing to CockroachDB. Please ensure you have followed the guidelines for creating a PR.

My owl senses detect your PR is good for review. Please keep an eye out for any test failures in CI.

I was unable to automatically find a reviewer. You can try CCing one of the following members:

  • A person you worked with closely on this PR.
  • The person who created the ticket, or a CRDB organization member involved with the ticket (author, commenter, etc.).
  • Join our community slack channel and ask on #contributors.
  • Try find someone else from here.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

@blathers-crl blathers-crl bot added O-community Originated from the community X-blathers-untriaged blathers was unable to find an owner labels Jan 6, 2021
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@blathers-crl
Copy link

blathers-crl bot commented Jan 6, 2021

Thank you for updating your pull request.

My owl senses detect your PR is good for review. Please keep an eye out for any test failures in CI.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

@alan-mas alan-mas force-pushed the 58421-eg-go-colexecagg branch 3 times, most recently from 46567bd to 9e3c47d Compare January 6, 2021 20:12
@@ -0,0 +1,70 @@
# Map between target name and relevant template.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd prefer to just put all of this in pkg/sql/colexec/colexecagg/BUILD.bazel. eg_go_filegroup and gen_eg_go_rules are not reusable, so defining them as utility functions doesn't provide any value. Just makes things more complicated for no reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am applying the same same treatment as 52c5f51. By pulling that inside pkg/sql/colexec/colexecagg/BUILD.bazel you mean follow the same logic that is already there in this PR or creating one gen_rule per file?

@@ -0,0 +1,70 @@
# Map between target name and relevant template.
targets = [
('hash_any_not_null_agg.eg.go', 'any_not_null_agg_tmpl.go'),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you just make this into a helper function? Something like:

def munge(s):
    if s.startswith('hash_'):
        return s[len('hash_'):].replace('.eg', '_tmpl')
    elif s.startswith('ordered_'):
        return s[len('ordered_'):].replace('.eg', '_tmpl')

munge('hash_any_not_null_agg.eg.go') => 'any_not_null_agg_tmpl.go'

Maybe something about Bazel is keeping you from doing this -- if so just let me know :)

Copy link
Contributor Author

@alan-mas alan-mas Jan 6, 2021

Choose a reason for hiding this comment

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

I can give a try, actually I was just following the same logic applied before in older commits but I can try my luck with that change you are suggesting and see what's happening =)

Also, do you think is necessary to create a whole new function to only get the tmpl target name, for example this one: ('ordered_sum_int_agg.eg.go', 'sum_agg_tmpl.go') on that one I would need to create an specific elif for checking that case?

I think that it would make it a bit complex for something pretty straight forward (only gets names for the tmpl file) but I might be wrong and maybe it would make it easier to understand.

Fixes cockroachdb#58421. For the go dependency changes, we've applied the same
treatment as cockroachdb@52c5f51b81.

Release note: None

Co-authored-by: irfan sharif <[email protected]>
@irfansharif irfansharif force-pushed the 58421-eg-go-colexecagg branch from 9e3c47d to 4e4cbd2 Compare January 6, 2021 23:00
Copy link
Contributor

@irfansharif irfansharif left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, LGTM. I've just amended the commit message and some comment slightly.

@irfansharif
Copy link
Contributor

bors r+

@craig
Copy link
Contributor

craig bot commented Jan 6, 2021

Build succeeded:

@craig craig bot merged commit f62055c into cockroachdb:master Jan 6, 2021
@alan-mas alan-mas deleted the 58421-eg-go-colexecagg branch January 7, 2021 17:23
@irfansharif irfansharif changed the title build: Generating eg.go files within the colexecagg package in bazel bazel: generate colexecagg .eg.go files within the sandbox Jan 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-community Originated from the community X-blathers-untriaged blathers was unable to find an owner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

build: Generating eg.go files within the colexecagg package in bazel sandbox
4 participants