lostluck commented on a change in pull request #13889: URL: https://github.com/apache/beam/pull/13889#discussion_r574013474
########## File path: sdks/go/pkg/beam/transforms/stats/quantiles_test.go ########## @@ -0,0 +1,291 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package stats + +import ( + "reflect" + "testing" + + "github.com/apache/beam/sdks/go/pkg/beam" + "github.com/apache/beam/sdks/go/pkg/beam/core/util/reflectx" + "github.com/apache/beam/sdks/go/pkg/beam/testing/passert" + "github.com/apache/beam/sdks/go/pkg/beam/testing/ptest" +) + +func init() { + beam.RegisterFunction(weightedElementToKv) + + // In practice, this runs faster than plain reflection. Review comment: In this case, I'd add a comment `// TODO(BEAM-9616): Remove once collisions don't occur for starcgen over test code and an equivalent is generated for us.` To be clear, the code you've got is fine. The hook is being correctly used, and my repo knows I wrote many of these things manually before getting the code generator functional. Ideally manual uses of these don't need to exist, and they're all generated. Go Generics, once they exists (in hopefully 1.18 next year) will allow the code generator to be largely replaced with generic implementations instead, and then everything can happen at compile time instead. [BEAM-9616 ](https://issues.apache.org/jira/browse/BEAM-9616) is the grab bag umbrella for various bugs and improvements that need to be done to starcgen to make it more robust. And it's not an "already runs" thing. Go generate statements are never automatically called by the go build system, and never by package users, always by package authors. The starcgen tool is so that Beam users can improve the performance of their own code with their own go generate statements, which they'd need to call as befits their development set up. See https://blog.golang.org/generate for more information. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
