use of org.flyte.api.v1.BindingData in project flytekit-java by flyteorg.
the class IfBlockIdl method toOperand.
private static Operand toOperand(Map<String, Binding> extraInputs, SdkBindingData bindingData) {
BindingData idl = bindingData.idl();
if (idl.kind() == BindingData.Kind.PROMISE) {
String nextVarName = "$" + extraInputs.size();
extraInputs.put(nextVarName, Binding.builder().binding(idl).var_(nextVarName).build());
return Operand.ofVar(nextVarName);
} else {
return Operand.ofPrimitive(bindingData.idl().scalar().primitive());
}
}
use of org.flyte.api.v1.BindingData in project flytekit-java by flyteorg.
the class SdkBindingData method ofStruct.
public static SdkBindingData ofStruct(SdkStruct struct) {
BindingData bindingData = BindingData.ofScalar(Scalar.ofGeneric(struct.struct()));
LiteralType literalType = LiteralType.ofSimpleType(SimpleType.STRUCT);
return create(bindingData, literalType);
}
use of org.flyte.api.v1.BindingData in project flytekit-java by flyteorg.
the class ProtoUtilTest method provideArgsForShouldSerializeBindingData.
static Stream<Arguments> provideArgsForShouldSerializeBindingData() {
BindingData apiScalar = BindingData.ofScalar(Scalar.ofPrimitive(Primitive.ofIntegerValue(1337L)));
Literals.BindingData protoScalar = Literals.BindingData.newBuilder().setScalar(Literals.Scalar.newBuilder().setPrimitive(Literals.Primitive.newBuilder().setInteger(1337L).build()).build()).build();
return Stream.of(Arguments.of(apiScalar, protoScalar), Arguments.of(BindingData.ofCollection(singletonList(apiScalar)), Literals.BindingData.newBuilder().setCollection(Literals.BindingDataCollection.newBuilder().addBindings(protoScalar).build()).build()), Arguments.of(BindingData.ofMap(singletonMap("foo", apiScalar)), Literals.BindingData.newBuilder().setMap(Literals.BindingDataMap.newBuilder().putBindings("foo", protoScalar).build()).build()), Arguments.of(BindingData.ofOutputReference(OutputReference.builder().nodeId("node-id").var("var").build()), Literals.BindingData.newBuilder().setPromise(Types.OutputReference.newBuilder().setNodeId("node-id").setVar("var").build()).build()));
}
use of org.flyte.api.v1.BindingData in project flytekit-java by flyteorg.
the class SdkBindingData method ofPrimitive.
public static SdkBindingData ofPrimitive(Primitive primitive) {
BindingData bindingData = BindingData.ofScalar(Scalar.ofPrimitive(primitive));
LiteralType literalType = LiteralType.ofSimpleType(getSimpleType(primitive.kind()));
return create(bindingData, literalType);
}
Aggregations