Skip to content

Commit

Permalink
change
Browse files Browse the repository at this point in the history
Signed-off-by: Future-Outlier <[email protected]>
  • Loading branch information
Future-Outlier committed Oct 30, 2024
1 parent 553a702 commit ddaaa20
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions flytepropeller/pkg/controller/nodes/array/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package array
import (
"context"
"fmt"
"github.com/flyteorg/flyte/flyteidl/clients/go/coreutils"
"github.com/shamaton/msgpack/v2"
"math"
"strconv"

Expand Down Expand Up @@ -222,6 +224,47 @@ func (a *arrayNodeHandler) Handle(ctx context.Context, nCtx interfaces.NodeExecu
fmt.Sprintf("input arrays have different lengths: expecting '%d' found '%d'", size, collectionLength), nil),
), nil
}
default:
// todo: check if is simple struct or not
// not sure should check or not
if variable.GetScalar().GetBinary() != nil {
binaryData := variable.GetScalar().GetBinary()
if binaryData.GetTag() == coreutils.MESSAGEPACK {
var currVal any
err := msgpack.Unmarshal(binaryData.GetValue(), &currVal)

if err != nil {
return handler.DoTransition(handler.TransitionTypeEphemeral,
handler.PhaseInfoFailure(idlcore.ExecutionError_SYSTEM, errors.RuntimeExecutionError,
"failed to decode msgpack binary data", nil),
), nil
}

Check warning on line 241 in flytepropeller/pkg/controller/nodes/array/handler.go

View check run for this annotation

Codecov / codecov/patch

flytepropeller/pkg/controller/nodes/array/handler.go#L227-L241

Added lines #L227 - L241 were not covered by tests
// TODO: PREVENT DECODED DATA IS NOT A COLLECTION TYPE
collectionLength := len(currVal.([]interface{}))
if size == -1 {
size = collectionLength
// construct a collection literal
//newLiteralMap, err := nCtx.InputReader().Get(ctx)
//if err != nil {
// return handler.UnknownTransition, err
//}
//
//newLiteralMap.Literals[key] = &idlcore.Literal{
// Value: &idlcore.Literal_Collection{
// Collection: &idlcore.LiteralCollection{
// Literals: []*idlcore.Literal{},
// },
// },
//}
} else if size != collectionLength {
return handler.DoTransition(handler.TransitionTypeEphemeral,
handler.PhaseInfoFailure(idlcore.ExecutionError_USER, errors.InvalidArrayLength,
fmt.Sprintf("input arrays have different lengths: expecting '%d' found '%d'", size, collectionLength), nil),
), nil
}

Check warning on line 264 in flytepropeller/pkg/controller/nodes/array/handler.go

View check run for this annotation

Codecov / codecov/patch

flytepropeller/pkg/controller/nodes/array/handler.go#L243-L264

Added lines #L243 - L264 were not covered by tests
}

}
}
}

Expand Down

0 comments on commit ddaaa20

Please sign in to comment.