Tiago Marques Godinho created IGNITE-27019:
----------------------------------------------
Summary: Update documentation for Partition API usage in Compute
Jobs
Key: IGNITE-27019
URL: https://issues.apache.org/jira/browse/IGNITE-27019
Project: Ignite
Issue Type: Improvement
Components: documentation ai3
Affects Versions: 3.1
Reporter: Tiago Marques Godinho
The documentation must be made more clear regarding usages of Partitions inside
compute jobs, specially when broadcasted to table partitions.
What to do:
# Make sure we have examples for TableBroadcast Job targets. Using
jobContext.partition() and passing it to SQL inside the job.
# MapReduce that works with table partitions.
# Add a section to the migration guide about collocated computes and partition
and local node queries. The documentation must clearly answer:
** How can I do `setPartition` in ignite 3 ?
*** Show an example of a Map/Reduce job or a compute job (with TableBroadcast
Job targets) fetching the context.partition() and injecting in it a SQL Query
using the `__PARTITION_ID` column.
** How can I do a local query ?
*** The user should prefer Map/Reduce or compute jobs (with TableBroadcast Job
targets) to guarantee local execution of queries.
*** Alternatively, the user can manually select local partitions using the
Partition Distribution API, however, this performs in a best-effort basis since
reassignments can happen concurrently. Nonetheless, might be good for
debugging/prototyping (not production code).
Notes:
Example 1:
{code:java}
// Map/Reduce style example (TableJobTarget)
submitAsync(BroadcastJobTarget.table(QualifiedName.of(null, "foo")),
jobDescriptor,args)
// Compute job implementation
CompletableFuture<R> executeAsync(JobExecutionContext context, @Nullable T arg)
{
Partition part = context.partition();
ignite.sql().execute("SELECT * FROM foo WHERE foo.__PARTITION_ID = ?",
part.id());
...
}
{code}
Example 2:
Similar to example 1 but using the MapReduce API.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)