Skip to content

feat(core): add bulkStream + bulkStreamWithResult for direct BulkItem ingest...#98

Merged
fupelaqu merged 2 commits into
mainfrom
feature/licensingInfrastructure
Jun 1, 2026
Merged

feat(core): add bulkStream + bulkStreamWithResult for direct BulkItem ingest...#98
fupelaqu merged 2 commits into
mainfrom
feature/licensingInfrastructure

Conversation

@fupelaqu
Copy link
Copy Markdown
Contributor

@fupelaqu fupelaqu commented Jun 1, 2026

...

fix(core): project bare .asInstanceOf in delegator + metrics bulk/search paths

fupelaqu added 2 commits June 1, 2026 14:02
… ingest

Stage 1 of the CTAS / INSERT INTO … SELECT-with-JOIN design

Adds two public methods to BulkApi:

  bulkStream(items: Source[BulkItem, NotUsed])
    : Source[Either[FailedDocument, SuccessfulDocument], NotUsed]

  bulkStreamWithResult(items, callbacks): Future[BulkResult]
…earch paths

`ElasticClientDelegator.toBulkElasticAction`, `extractBulkResults`,
`actionToBulkItem`, `bulkFlow`, and `MetricsElasticClient.singleSearchAsync` /
`multiSearchAsync` cast the result of `delegate.*` through bare `.asInstanceOf`
(no type argument). Scala infers `Nothing`, and the synthetic cast at the call
site explodes the moment the delegated pipeline is exercised end-to-end
(`BulkOperation → scala.runtime.Nothing$` ClassCastException). Latent — there
was no real caller of `bulkStream`/`bulkStreamWithResult` through the
metrics/monitored delegator chain until the sidecar row-1 INSERT/CTAS executor
in softclient4es-arrow added one.

Alias `delegate` to a stable local `val d` (the field is `def`, not `val`, so
it isn't a stable identifier on its own) and project to the right
path-dependent type — `d.BulkActionType`, `d.BulkResultType`, or this trait's
own `Future[ElasticResult[ElasticResponse]]`. All abstract A/R types still
erase to Object, so the runtime cast is a no-op.
@fupelaqu fupelaqu marked this pull request as ready for review June 1, 2026 20:11
@fupelaqu fupelaqu merged commit 452ca73 into main Jun 1, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant