diff --git a/flytekit-examples/src/main/java/org/flyte/examples/AllInputsTask.java b/flytekit-examples/src/main/java/org/flyte/examples/AllInputsTask.java index 32a5a0686..a37cd3045 100644 --- a/flytekit-examples/src/main/java/org/flyte/examples/AllInputsTask.java +++ b/flytekit-examples/src/main/java/org/flyte/examples/AllInputsTask.java @@ -23,10 +23,8 @@ import java.util.List; import java.util.Map; import org.flyte.api.v1.Blob; -import org.flyte.api.v1.BlobType.BlobDimensionality; import org.flyte.flytekit.SdkBindingData; import org.flyte.flytekit.SdkRunnableTask; -import org.flyte.flytekit.jackson.BlobTypeDescription; import org.flyte.flytekit.jackson.JacksonSdkType; @AutoService(SdkRunnableTask.class) @@ -51,7 +49,6 @@ public abstract static class AutoAllInputsInput { public abstract SdkBindingData<Duration> d(); - @BlobTypeDescription(format = "csv", dimensionality = BlobDimensionality.MULTIPART) public abstract SdkBindingData<Blob> blob(); public abstract SdkBindingData<List<String>> l(); @@ -94,7 +91,6 @@ public abstract static class AutoAllInputsOutput { public abstract SdkBindingData<Duration> d(); - @BlobTypeDescription(format = "csv", dimensionality = BlobDimensionality.MULTIPART) public abstract SdkBindingData<Blob> blob(); public abstract SdkBindingData<List<String>> l(); diff --git a/flytekit-examples/src/main/java/org/flyte/examples/AllInputsWorkflow.java b/flytekit-examples/src/main/java/org/flyte/examples/AllInputsWorkflow.java index 30dfe0793..3956bcc5e 100644 --- a/flytekit-examples/src/main/java/org/flyte/examples/AllInputsWorkflow.java +++ b/flytekit-examples/src/main/java/org/flyte/examples/AllInputsWorkflow.java @@ -35,7 +35,6 @@ import org.flyte.flytekit.SdkTypes; import org.flyte.flytekit.SdkWorkflow; import org.flyte.flytekit.SdkWorkflowBuilder; -import org.flyte.flytekit.jackson.BlobTypeDescription; import org.flyte.flytekit.jackson.JacksonSdkType; @AutoService(SdkWorkflow.class) @@ -110,7 +109,6 @@ public abstract static class AllInputsWorkflowOutput { public abstract SdkBindingData<Duration> d(); - @BlobTypeDescription(format = "csv", dimensionality = BlobDimensionality.MULTIPART) public abstract SdkBindingData<Blob> blob(); public abstract SdkBindingData<List<String>> l(); diff --git a/flytekit-jackson/src/main/java/org/flyte/flytekit/jackson/BlobTypeDescription.java b/flytekit-jackson/src/main/java/org/flyte/flytekit/jackson/BlobTypeDescription.java deleted file mode 100644 index 0fe5c791f..000000000 --- a/flytekit-jackson/src/main/java/org/flyte/flytekit/jackson/BlobTypeDescription.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2023 Flyte Authors. - * - * Licensed 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 org.flyte.flytekit.jackson; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; -import org.flyte.api.v1.BlobType.BlobDimensionality; - -/** Applied to a blob property to annotate its type. */ -@Target({ElementType.FIELD, ElementType.METHOD}) -@Retention(RetentionPolicy.RUNTIME) -public @interface BlobTypeDescription { - /** - * Describes the blob's format. - * - * @return format, not {@code null} - */ - String format(); - - /** - * Describes the blob's dimensionality. - * - * @return dimensionality, not {@code null} - */ - BlobDimensionality dimensionality(); -} diff --git a/flytekit-jackson/src/main/java/org/flyte/flytekit/jackson/VariableMapVisitor.java b/flytekit-jackson/src/main/java/org/flyte/flytekit/jackson/VariableMapVisitor.java index c100b81c3..0b9c5acaf 100644 --- a/flytekit-jackson/src/main/java/org/flyte/flytekit/jackson/VariableMapVisitor.java +++ b/flytekit-jackson/src/main/java/org/flyte/flytekit/jackson/VariableMapVisitor.java @@ -32,6 +32,7 @@ import java.util.Map; import org.flyte.api.v1.Blob; import org.flyte.api.v1.BlobType; +import org.flyte.api.v1.BlobType.BlobDimensionality; import org.flyte.api.v1.Variable; import org.flyte.flytekit.SdkBindingData; import org.flyte.flytekit.SdkLiteralType; @@ -168,18 +169,11 @@ private SdkLiteralType<?> toLiteralType( return SdkLiteralTypes.maps(toLiteralType(valueType, false, propName, member)); } else if (Blob.class.isAssignableFrom(type)) { - BlobTypeDescription annotation = member.getAnnotation(BlobTypeDescription.class); - if (annotation == null) { - throw new UnsupportedOperationException( - String.format( - "Field '%s' from class '%s' is declared as '%s' and it must be annotated", - propName, member.getMember().getDeclaringClass().getName(), type)); - } + // fixme: create blob type from annotation, or rethink how we could offer the offloaded data + // feature + // https://docs.flyte.org/projects/flytekit/en/latest/generated/flytekit.BlobType.html#flytekit-blobtype return SdkLiteralTypes.blobs( - BlobType.builder() - .format(annotation.format()) - .dimensionality(annotation.dimensionality()) - .build()); + BlobType.builder().format("").dimensionality(BlobDimensionality.SINGLE).build()); } // TODO: Support structs throw new UnsupportedOperationException( diff --git a/flytekit-jackson/src/test/java/org/flyte/flytekit/jackson/JacksonSdkTypeTest.java b/flytekit-jackson/src/test/java/org/flyte/flytekit/jackson/JacksonSdkTypeTest.java index 38fd83639..33a97e359 100644 --- a/flytekit-jackson/src/test/java/org/flyte/flytekit/jackson/JacksonSdkTypeTest.java +++ b/flytekit-jackson/src/test/java/org/flyte/flytekit/jackson/JacksonSdkTypeTest.java @@ -41,7 +41,6 @@ import org.flyte.api.v1.Blob; import org.flyte.api.v1.BlobMetadata; import org.flyte.api.v1.BlobType; -import org.flyte.api.v1.BlobType.BlobDimensionality; import org.flyte.api.v1.Literal; import org.flyte.api.v1.LiteralType; import org.flyte.api.v1.Primitive; @@ -545,7 +544,6 @@ public abstract static class AutoValueInput { public abstract SdkBindingData<Duration> d(); - @BlobTypeDescription(format = "", dimensionality = BlobDimensionality.SINGLE) public abstract SdkBindingData<Blob> blob(); public abstract SdkBindingData<List<String>> l(); diff --git a/flytekit-scala_2.13/src/main/scala/org/flyte/flytekitscala/SdkScalaType.scala b/flytekit-scala_2.13/src/main/scala/org/flyte/flytekitscala/SdkScalaType.scala index bd75cb68a..25f03122a 100644 --- a/flytekit-scala_2.13/src/main/scala/org/flyte/flytekitscala/SdkScalaType.scala +++ b/flytekit-scala_2.13/src/main/scala/org/flyte/flytekitscala/SdkScalaType.scala @@ -231,7 +231,8 @@ object SdkScalaType { implicit def durationLiteralType: SdkScalaLiteralType[Duration] = DelegateLiteralType(SdkLiteralTypes.durations()) - // fixme: create blob type from annotation + // fixme: create blob type from annotation, or rethink how we could offer the offloaded data feature + // https://docs.flyte.org/projects/flytekit/en/latest/generated/flytekit.BlobType.html#flytekit-blobtype implicit def blobLiteralType: SdkScalaLiteralType[Blob] = DelegateLiteralType( SdkLiteralTypes.blobs(