uranusjr commented on code in PR #72019:
URL: https://github.com/apache/airflow/pull/72019#discussion_r4012101264
##########
java-sdk/adr/0002-native-dag-interface.md:
##########
@@ -94,18 +138,57 @@ public final class EtlPipeline_Dag {
public void execute(Context context, Client client) throws Exception {
TaskArgs args = TaskArgs.of(context);
long extracted = args.require(0, Long.class);
- EtlPipeline tasks = new EtlPipeline();
- tasks.bind(context, client);
- client.setXCom(tasks.transform(extracted));
+ double threshold = 0.9; // baked from lit(0.9) at Dag-build time
+ client.setXCom(new EtlPipeline().transform(client, context, extracted,
threshold));
}
}
- // Extract and Load follow the same shape.
+ // Extract, Load, Audit, and Notify follow the same shape.
}
```
-`bind(context, client)` is what `getClient()` and `getContext()` return for
that invocation, and a
-getter called with nothing bound throws.
+The injected arguments are passed straight into the user method, and the data
arguments bind by
+position through the same internal `TaskArgs` the mixed-language surface uses
+([ADR-0001](0001-mixed-lang-dag-interface.md)) — no getters, no `bind()`,
nothing ambient.
+
+**Literals.** A data argument is an `Arg<T>`, which a `TaskRef` satisfies; a
constant is wrapped
+with `lit(...)` — `transform(extract(), lit(0.9))` — and recorded as a baked
value with no edge.
+Wrapping is required because a bare `Integer` cannot implement `Arg`; boxed
types only, no
+primitives.
+
+### Non-TaskFlow dependencies
+
+A TaskFlow (data) edge comes for free from passing a `TaskRef` into another
wiring method. A
+dependency where **no data flows** — Python's `a >> b`, and the list forms `a
>> [b, c]` and
+`[x, y] >> z` — is expressed instead with two variadic verbs that every
`TaskRef` carries, `then`
+and `after`. Both live on a small `Chain` interface, and a `TaskRef` is a
`Chain` of one
+(`interface TaskRef<T> extends Arg<T>, Chain`):
+
+```java
+a.then(b, c); // a >> [b, c]
+z.after(x, y); // z << [x, y]
+```
+
+`then` and `after` are mirror images, and each returns the **new frontier**
(the set it just pointed
+at), the way `>>`/`<<` evaluate to their right operand, so a chain walks
through a fan:
+
+```java
+a.then(b, c).then(d); // a >> [b, c] >> d (a->b, a->c, then b->d, c->d)
+```
+
+The one thing the verbs cannot do is start from a *set*: Java can't overload
`>>` the way Python
+does, and there is no list literal to call `.then` on, so `Flow.of` opens a
chain from one:
+
+```java
+Flow.of(a, b).then(c); // [a, b] >> c
Review Comment:
A bullet point added for this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]