Uploaded image for project: 'Beam'
  1. Beam
  2. BEAM-4401

beam.Create fails to encode valid elements

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.5.0
    • Component/s: sdk-go
    • Labels:
      None

      Description

      The following program will panic because part of the proto3 message cannot be JSON marshalled.

      panic: failed to decode data: json: cannot unmarshal object into Go struct field Path_Node.Specialization of type internal_go_proto.isPath_Node_Specialization
      
      package main
      
      import (
      	"context"
      
      	"github.com/apache/beam/sdks/go/pkg/beam"
      	"github.com/apache/beam/sdks/go/pkg/beam/x/beamx"
      	"github.com/apache/beam/sdks/go/pkg/beam/x/debug"
      
      	ipb "kythe.io/kythe/proto/internal_go_proto"
      	srvpb "kythe.io/kythe/proto/serving_go_proto"
      )
      
      func main() {
      	ctx := context.Background()
      	beam.Init()
      
      	p := beam.NewPipeline()
      	s := p.Root()
      
      	e := &ipb.Path_Node{
      		// proto3 oneof fields cannot be JSON marshalled
      		Specialization: &ipb.Path_Node_RawAnchor{&srvpb.RawAnchor{}},
      	}
      	els := beam.Create(s, e)
      	debug.Print(s, els)
      
      	if err := beamx.Run(ctx, p); err != nil {
      		panic(err)
      	}
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                schroederc Cody Schroeder
                Reporter:
                schroederc Cody Schroeder
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 10m
                  1h 10m