Repository navigation
Conversation
Contributor
|
@nvasiu could you split this PR into smaller ones so that the changes don't rely on new models can be merged early? |
nvasiu
force-pushed
the
feat/distributed-map-operation
branch
from
November 20, 2026 18:27
264fc4e to
b15a796
Compare
Contributor
Author
|
Update to improve the authoring helpers, following review feedback: Helpers instead of wrappers
Per-item error log
Documentation
Tests
Also rebased onto the latest |
Add the types a distributed map run is built from: the source, processor, completion and destination config, the summary and result types, and the helpers a processor or reader Lambda calls in its handler.
nvasiu
force-pushed
the
feat/distributed-map-operation
branch
from
November 20, 2026 21:15
b15a796 to
8ecc0f1
Compare
Contributor
Author
|
@zhongkechen Split up this PR into 2. Now this PR only contains all the changes that can merge without the new model. I made a second PR #901 containing the rest of the Dmap operation changes that depend on the model. |
4 of 5 tasks
zhongkechen
reviewed
Nov 20, 2026
|
|
||
| // Lambda response size limit is 6MB minus small epsilon for envelope | ||
| private static final int LAMBDA_RESPONSE_SIZE_LIMIT = 6 * 1024 * 1024 - 50; | ||
| private static final SerDes JSON = new JacksonSerDes(); |
Contributor
There was a problem hiding this comment.
Do we need NON_NULL here
| var records = event.records(); | ||
| var bodies = new ArrayList<String>(records.size()); | ||
| for (var record : records) { | ||
| bodies.add(record.body()); |
Contributor
There was a problem hiding this comment.
handle null body properly
| * @param distributedMapRunArn the ARN of the distributed map run this batch belongs to | ||
| * @param records the items in this batch | ||
| */ | ||
| public record ProcessorEvent(String distributedMapRunArn, List<ProcessorRecord> records) { |
Contributor
There was a problem hiding this comment.
handle null record in records
|
|
||
| /** | ||
| * Thrown by throwIfError when a distributed map run did not fully succeed, or when an item failed on a run that | ||
| * otherwise succeeded. It reports an aggregate run result and is not a single operation failure, so it stays out of the |
Contributor
There was a problem hiding this comment.
Isn't a single run always mapping to a single dmap operation?
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Issue Link, if available
N/A
Description
This is the first of two PRs. Nothing in this PR uses the new Lambda model, so it can merge before the model is released. The second PR, #901, adds
ctx.distributedMapand the operation that starts a run and reads its outcome, which needs the new model.Adds the types the distributed map operation is built from to the Java SDK: the config types a customer constructs to describe a map run, the result types it returns, and the helpers a processor or reader Lambda calls in its handler.
A map run processes a bounded dataset in parallel. A customer starts a map run from a durable function, naming a source to read items from, a processor function to invoke per batch, and concurrency, retry, and failure settings. The service reads items from the source, groups them into batches, invokes the processor for each batch, retries failures, tracks progress, routes successful results and failed items to destinations, and reports completion.
config/The input types a customer constructs to describe a map run.
DistributedMapConfig: optional settings for distributed map. ItsCompletionConfigdefines item failure thresholds for marking the overall map run failed.DistributedMapSource: factories naming where map run items come from.inline,s3JsonLines,s3JsonArray,s3Csv,s3Objects,s3FlattenedJsonLines,s3FlattenedJsonArray,s3FlattenedCsvandreader.DistributedMapProcessor: describes the Lambda that processes items. ThereportBatchOutcomeandreportItemOutcomesfactories pick how the processor reports outcomes back. The retry option takes aDistributedMapProcessorRetryConfigholdingmaxRetryAttemptsandmaxRetryDuration, withDistributedMapProcessorRetryConfig.UNLIMITEDfor an unbounded attempt count.DistributedMapDestination: thes3Successesands3Failuresfactories for routing item records to S3.UNLIMITED.model/The result types a customer receives back from a map run.
DistributedMapSummary: describes the run's overall outcome.DistributedMapResult: contains individual map run item outcomes.DistributedMapError: the error on a run or on one item.DistributedMapStatus: the run's terminal status.dmap/DistributedMapHelpers.javaAuthoring helpers for the processor and reader Lambdas, which a customer calls inside their own handler, so they write a plain function rather than the item or batch protocol.
processDistributedMapItems,processDistributedMapBatchandreadDistributedMapPage.FLATctx.mapby default, with a nesting option.ItemContext,BatchContextandReaderContext, passed as the last argument.processDistributedMapItemswrites one ERROR log line for each failed item, withdistributedMapRunArn,itemIdand the error it reports.dmap/The records the helpers read and return.
ProcessorEvent,ProcessorRecordandReaderEvent: the events the service sends to a processor or reader Lambda.ItemHandlerResponse,ItemResult,ItemFailureandReaderResponse: the responses the helpers build, rather than hand-built maps.ItemContext,BatchContextandReaderContext: the run ARN and item ids passed to the customer's function.execution/DurableExecutor.javaexception/DistributedMapException.javaThe error type a customer catches.
DistributedMapException: thrown bythrowIfError()when a run or an item fails.Future tasks
ctx.distributedMapand the distributed map operation, in #901 .LocalDurableTestRunner(in the testing package). When this is done, we can add full end to end tests using the runner.Demo/Screenshots
N/A
Design
See Rules for every change.
+1899lines insrc/mainand+2521insrc/test.config/with their nested types and factories, 4 result types inmodel/, the 3 helpers inDistributedMapHelperswith their 2 functional interfaces, 11 records indmap/, and 1 exception type.Assumptions
Each assumption about the service, Lambda, the runtime or another library, with its evidence, or marked "unverified" (rule 6):
distributedMapRunArnand arecordslist, each record holding a non-empty stringitemIdand abodythe customer's serdes decodes. Unverified.itemIdthe processor echoes, and accepts the batch-failure and item-outcome response shapes the helpers return. Unverified.distributedMapRunArn, an integermaxItemsPerPage, andstateas the reader last returned it. Unverified.Decisions not covered by the issue or the design note
One line each, with the reason (rule 7):
IllegalArgumentException, because the other operations' configuration checks throw it.DistributedMapExceptionstays outside theDurableOperationExceptionhierarchy, because it reports a run's aggregate result rather than one operation's failure.DurableExecutorpicks the default JSON serdes when the input type isProcessorEvent, so a customer serdes cannot change the format the service defines, with no new public method orDurableConfigoption.DistributedMapSource, nameds3JsonLinesand so on, so the factory name states the source kind in one call.DurableContextfirst.FLATnesting by default, because it uses fewer operations.ctx.map's own default staysNESTED."null", and a non-null value that serializes to null is rejected, because the service requires every item to be a string.Checklist
Testing
Unit Tests
Have unit tests been written for these changes?
Yes. Tests are split by layer so each sits alongside its class.
config/DistributedMap*Test: config and argument validation.model/DistributedMapSummaryTestandmodel/DistributedMapResultTest: the result types andthrowIfError().dmap/DistributedMapHelpersTestanddmap/DistributedMapDurableHelpersTest: helper tests, checking that they process items, report failures, pass the run ARN and item ids, reject bad inputs, run inFLATand nested modes, and write the error log line.sdk/pom.xmladds the test-onlyaws-lambda-java-serializationdependency, so a test checks that the Lambda runtime's own serializer reads the events. No existing test expectation was edited.Integration Tests
Have integration tests been written for these changes?
No.
LocalDurableTestRunnerdoes not support distributed map yet (see Future tasks).Examples
Has a new example been added for the change? (if applicable)
No. Examples will follow with runner support (see Future tasks).