You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/06/29 14:06:22 UTC

[GitHub] [beam] jrmccluskey commented on a diff in pull request #22019: Remove unused legacy dataflow translate code

jrmccluskey commented on code in PR #22019:
URL: https://github.com/apache/beam/pull/22019#discussion_r909680643


##########
sdks/go/pkg/beam/runners/dataflow/dataflowlib/translate.go:
##########
@@ -1,363 +0,0 @@
-// 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 dataflowlib
-
-import (
-	"bytes"
-	"encoding/json"
-	"fmt"
-	"net/url"
-	"path"
-
-	"github.com/apache/beam/sdks/v2/go/pkg/beam/core/graph/coder"
-	"github.com/apache/beam/sdks/v2/go/pkg/beam/core/graph/mtime"
-	"github.com/apache/beam/sdks/v2/go/pkg/beam/core/graph/window"
-	"github.com/apache/beam/sdks/v2/go/pkg/beam/core/runtime/exec"
-	"github.com/apache/beam/sdks/v2/go/pkg/beam/core/runtime/graphx"
-	"github.com/apache/beam/sdks/v2/go/pkg/beam/core/runtime/pipelinex"
-	"github.com/apache/beam/sdks/v2/go/pkg/beam/core/typex"
-	"github.com/apache/beam/sdks/v2/go/pkg/beam/core/util/protox"
-	"github.com/apache/beam/sdks/v2/go/pkg/beam/core/util/reflectx"
-	"github.com/apache/beam/sdks/v2/go/pkg/beam/core/util/stringx"
-	"github.com/apache/beam/sdks/v2/go/pkg/beam/internal/errors"
-	pipepb "github.com/apache/beam/sdks/v2/go/pkg/beam/model/pipeline_v1"
-	"github.com/golang/protobuf/proto"
-	df "google.golang.org/api/dataflow/v1b3"
-)
-
-const (
-	impulseKind    = "CreateCollection"
-	parDoKind      = "ParallelDo"
-	combineKind    = "CombineValues"
-	flattenKind    = "Flatten"
-	gbkKind        = "GroupByKey"
-	windowIntoKind = "Bucket"
-
-	sideInputKind = "CollectionToSingleton"
-)
-
-// translate translates a pipeline into a sequence of Dataflow steps. The step
-// representation and its semantics are complex. In particular, the service
-// optimizes the steps (step fusing, etc.) and may move steps around. Our
-// decorations of the steps must thus be robust against such changes, so that
-// they can be properly decoded in the harness. There are multiple quirks and
-// requirements of specific semi-opaque formats, such as base64 encoded blobs.
-//
-// Moreover, the harness sees pieces of the translated steps only -- not the
-// full graph. Special steps are also inserted around GBK, for example, which
-// makes the placement of the decoration somewhat tricky. The harness will
-// also never see steps that the service executes directly, notably GBK/CoGBK.
-func translate(p *pipepb.Pipeline) ([]*df.Step, error) {
-	// NOTE: Dataflow apparently assumes that the steps are in topological order.
-	// Otherwise, it fails with "Output out for step  was not found.". We assume
-	// the pipeline has been normalized and each subtransform list is in such order.
-
-	x := newTranslator(p.GetComponents())
-	return x.translateTransforms("", p.GetRootTransformIds())
-}
-
-type translator struct {
-	comp          *pipepb.Components
-	pcollections  map[string]*outputReference
-	coders        *graphx.CoderUnmarshaller
-	bogusCoderRef *graphx.CoderRef
-}
-
-func newTranslator(comp *pipepb.Components) *translator {
-	bytesCoderRef, _ := graphx.EncodeCoderRef(coder.NewW(coder.NewBytes(), coder.NewGlobalWindow()))

Review Comment:
   The CoderRef stuff seems to still be used in graphx/user.go and beam/encoding.go, I'm not sure that's dead code



-- 
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.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org