diff --git a/flytepropeller/pkg/compiler/validators/utils.go b/flytepropeller/pkg/compiler/validators/utils.go index b401227ab6..038a06ffa3 100644 --- a/flytepropeller/pkg/compiler/validators/utils.go +++ b/flytepropeller/pkg/compiler/validators/utils.go @@ -233,7 +233,11 @@ func (t collectionInstanceChecker) isInstance(lit *core.Literal) bool { return false } for _, x := range lit.GetCollection().Literals { - if !IsInstance(x, t.literalType.GetCollectionType()) { + if _, ok := x.GetValue().(*core.Literal_OffloadedMetadata); ok { + if !AreTypesCastable(x.GetOffloadedMetadata().GetInferredType(), t.literalType) { + return false + } + } else if !IsInstance(x, t.literalType.GetCollectionType()) { return false } } @@ -249,7 +253,11 @@ func (t mapInstanceChecker) isInstance(lit *core.Literal) bool { return false } for _, x := range lit.GetMap().Literals { - if !IsInstance(x, t.literalType.GetMapValueType()) { + if _, ok := x.GetValue().(*core.Literal_OffloadedMetadata); ok { + if !AreTypesCastable(x.GetOffloadedMetadata().GetInferredType(), t.literalType) { + return false + } + } else if !IsInstance(x, t.literalType.GetMapValueType()) { return false } } diff --git a/flytepropeller/pkg/compiler/validators/utils_test.go b/flytepropeller/pkg/compiler/validators/utils_test.go index 0bdc7ac4aa..af62161653 100644 --- a/flytepropeller/pkg/compiler/validators/utils_test.go +++ b/flytepropeller/pkg/compiler/validators/utils_test.go @@ -5,13 +5,12 @@ import ( "github.com/shamaton/msgpack/v2" "github.com/stretchr/testify/assert" - "google.golang.org/protobuf/proto" "github.com/flyteorg/flyte/flyteidl/clients/go/coreutils" "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core" ) -func TestLiteralTypeForLiterals(t *testing.T) { +func TestIsInstance(t *testing.T) { t.Run("empty", func(t *testing.T) { assert.True(t, IsInstance(nil, &core.LiteralType{ Type: &core.LiteralType_Simple{