exec: template the distinct operator#31957
Conversation
3924498 to
a7da435
Compare
|
PTAL |
a7da435 to
4427a7f
Compare
asubiotto
left a comment
There was a problem hiding this comment.
LGTM. Very educational PR.
Reviewed 6 of 8 files at r1.
Reviewable status:complete! 0 of 0 LGTMs obtained
Makefile, line 1315 at r1 (raw file):
@$(settings-doc-gen) gen settings-list --format=html > $@ pkg/sql/exec/distinct.og.go: pkg/sql/exec/distinct_tmpl.go
Is it necessary to have the _tmpl and _gen files in pkg/sql/exec? I like how the projection ops template is in execgen but I guess that might be more difficult to do with this approach. This is just being nitpicky but wondering if we can find a better structure.
|
That being said I do hear your point. If you can figure out a better way for this I'm all ears, and I'm definitely going to keep thinking on it over time. bors r+ |
Build failed (retrying...) |
4427a7f to
5f4ee05
Compare
Canceled |
|
Needed to rebase to pick up the decimal/date stuff, good to go now though. bors r+ |
31957: exec: template the distinct operator r=jordanlewis a=jordanlewis
Template the distinct operator using a new approach, where the template
file is normal executable Go, but prevented from being compiled normally
by a build tag.
The generator file reads the template file in, replaces some special
variables with template variables, and runs the template.
There are two main warts with this approach:
1. ColVec needed to be extended with a dummy _TemplateType method whose
signature is _TemplateType() []interface{}, so the template can
compile. That method is implemented to always panic().
2. The template generator needs to textually replace things in a way
that can be confusing. _TYPE, _GOTYPE, _TYPES_T, _EQUALITY_FN, and
_TemplateType all need to be replaced, with {{.}}, {{.GoTypeName}},
types.{{.}}, {{.EqualityFunction}} and {{.}} respectively.
Also, rename distinctFinalizerOp to boolVecToSelOp and move to its own
file. The implementation doesn't change.
Release note: None
Co-authored-by: Jordan Lewis <jordanthelewis@gmail.com>
Template the distinct operator using a new approach, where the template
file is normal executable Go, but prevented from being compiled normally
by a build tag.
The generator file reads the template file in, replaces some special
variables with template variables, and runs the template.
There are two main warts with this approach:
1. ColVec needed to be extended with a dummy _TemplateType method whose
signature is _TemplateType() []interface{}, so the template can
compile. That method is implemented to always panic().
2. The template generator needs to textually replace things in a way
that can be confusing. _TYPE, _GOTYPE, _TYPES_T, _EQUALITY_FN, and
_TemplateType all need to be replaced, with {{.}}, {{.GoTypeName}},
types.{{.}}, {{.EqualityFunction}} and {{.}} respectively.
Also, rename distinctFinalizerOp to boolVecToSelOp and move to its own
file. The implementation doesn't change.
Release note: None
5f4ee05 to
c907806
Compare
|
bors r+ |
Build failed |
|
Flaky test: bors r+ |
|
The batch crashed. Bors really hates this PR. bors r+ |
31957: exec: template the distinct operator r=jordanlewis a=jordanlewis
Template the distinct operator using a new approach, where the template
file is normal executable Go, but prevented from being compiled normally
by a build tag.
The generator file reads the template file in, replaces some special
variables with template variables, and runs the template.
There are two main warts with this approach:
1. ColVec needed to be extended with a dummy _TemplateType method whose
signature is _TemplateType() []interface{}, so the template can
compile. That method is implemented to always panic().
2. The template generator needs to textually replace things in a way
that can be confusing. _TYPE, _GOTYPE, _TYPES_T, _EQUALITY_FN, and
_TemplateType all need to be replaced, with {{.}}, {{.GoTypeName}},
types.{{.}}, {{.EqualityFunction}} and {{.}} respectively.
Also, rename distinctFinalizerOp to boolVecToSelOp and move to its own
file. The implementation doesn't change.
Release note: None
Co-authored-by: Jordan Lewis <jordanthelewis@gmail.com>
Build succeeded |
Template the distinct operator using a new approach, where the template
file is normal executable Go, but prevented from being compiled normally
by a build tag.
The generator file reads the template file in, replaces some special
variables with template variables, and runs the template.
There are two main warts with this approach:
signature is _TemplateType() []interface{}, so the template can
compile. That method is implemented to always panic().
that can be confusing. _TYPE, _GOTYPE, _TYPES_T, _EQUALITY_FN, and
_TemplateType all need to be replaced, with {{.}}, {{.GoTypeName}},
types.{{.}}, {{.EqualityFunction}} and {{.}} respectively.
Also, rename distinctFinalizerOp to boolVecToSelOp and move to its own
file. The implementation doesn't change.
Release note: None