[Feature Request]: Add batch sequence retrieval support to the Add Sequence transform
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- java
- Ambito
- data-engineering
Direzione di ricerca
Start with the Add Sequence transform and its documentation at the linked manual page. Check how it retrieves sequence values and how its settings and database connections are handled, then look for related transform tests. Done means an optional batch mode supports a configurable size, retrieves actual sequence values, assigns them to rows, and leaves the existing behavior intact when disabled.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What would you like to happen?
Current Behavior
The existing Add Sequence transform supports database sequences, but currently retrieves one sequence value for each input row.
For large pipelines, this results in many individual database queries just to generate sequence IDs.
Problem
When processing thousands or millions of rows, retrieving sequence values one at a time introduces unnecessary database round trips and can significantly affect pipeline performance, especially when database latency is high.
For example, processing 100,000 rows currently requires approximately 100,000 sequence retrieval queries.
It would be more efficient to retrieve multiple sequence values in a single query and use them locally until the batch is exhausted.
Proposed Enhancement
I would like the Add Sequence transform to support an optional batch retrieval mode when using database sequences.
The proposed enhancement would allow users to:
- Enable or disable batch sequence retrieval.
- Configure the batch size, for example 1,000 values.
- Support Hop variables for the batch size.
- Retrieve multiple actual sequence values from the database in a single query.
- Keep the retrieved values in memory and assign one value to each incoming row.
- Automatically retrieve another batch when all reserved values have been used.
- Preserve the current behavior when batch retrieval is disabled.
For Oracle, the batch retrieval could use a query similar to:
SELECT SEQ_SERVICO_VIGENCIA.NEXTVAL
FROM DUAL
CONNECT BY LEVEL <= ?
The batch size would be configurable rather than hardcoded.
Each value must come from an actual database sequence evaluation. The implementation should not assume that sequence values are consecutive or generate additional IDs by incrementing the first retrieved value.
Expected Behavior
With a batch size of 1,000:
- The first incoming row triggers a query retrieving 1,000 sequence values.
- The values are stored in memory.
- Each incoming row receives one reserved sequence value.
- After consuming all 1,000 values, another batch is retrieved.
- Processing continues until all incoming rows are handled.
For example, processing 100,000 rows would require approximately 100 batch retrieval queries instead of 100,000 individual queries.
Unused values from the final batch do not need to be reused.
The implementation should also handle concurrent pipeline executions safely, preserving the uniqueness guarantees of the underlying database sequence.
Use Case
I currently use a JavaScript transform in Apache Hop to implement this behavior with an Oracle database.
The script:
- Uses an existing Hop database connection.
- Reads the batch size from a Hop variable, defaulting to 1,000.
- Retrieves actual Oracle
NEXTVALvalues in batches. - Stores the results in memory.
- Assigns one value to each incoming row.
- Retrieves another batch only when needed.
- Uses
BigDecimalto preserve numeric precision.
This approach avoids executing a separate SQL query for every input row.
Having this functionality directly in the Add Sequence transform would eliminate the need for custom JavaScript and make it easier to configure and maintain.
Benefits
- Fewer database round trips when generating sequence IDs.
- Better performance in high-volume ETL pipelines.
- Less dependency on custom JavaScript implementations.
- Configurable batch sizes for different workloads.
- Reuse of existing database connection and sequence settings.
- Backward compatibility with the current Add Sequence behavior.
Reference
Existing Apache Hop Add Sequence documentation:
https://hop.apache.org/manual/latest/pipeline/transforms/addsequence.html
The initial implementation could focus on Oracle, with support for other database types where equivalent batch sequence retrieval is available.
Issue Priority
Priority: 3
Issue Component
Component: Transforms
- Lingua principale
- Java
- Stelle
- 1.6k
- Fork
- 499
- Merge medio
- 1g 5h
- PR unite (30g)
- 316
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di apache/hop
-
Beam P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
I maintainer di solito rispondono entro 1 giorno
-
awaiting triage Hop Gui P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
apache/hop#9325 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
awaiting triage Documentation P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
awaiting triage Documentation P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
awaiting triage Documentation P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
CI: LFC/ANTLR caches still use the old lfc/ paths, so the ANTLR jar is downloaded on every runForse già presa @NicoBiernat l’ha presa oggi. Apertabug CI
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
lf-lang/reactor-uc#443 ·
I maintainer di solito rispondono entro 4 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
Card-Forge/forge#13128 ·
I maintainer di solito rispondono entro 1 giorno
-
client documentation
Difficoltà 1/5 1-3 ore Idoneità per principianti 86/100
ClickHouse/clickhouse-java#3469 ·
I maintainer di solito rispondono entro 1 giorno
-
bug good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno