An ETL pipeline passes records through an ordered sequence of transformation stages. The output of one stage becomes the input of the next, so changing the stage order can change the final result.
Design an EtlPipelineProcessor class:
EtlPipelineProcessor() creates a stateless processor.int[] transform(int[] data, String[] operations) applies every operation in order and returns the final records.
Each entry in operations is one of:
"double": multiply every current value by 2."increment": add 1 to every current value."keepEven": retain only current values divisible by 2."keepPositive": retain only current values greater than 0.
Map operations preserve the current record order and count. Filter operations preserve the relative order and duplicates of the records they retain. Do not modify data or operations, and treat every call independently.
Example 1:
Input:
Output:
Explanation: The "double" stage produces [2,4,6,8,10]. Every value in that intermediate result is even, so "keepEven" retains them all.
Example 2:
Input:
Output:
Explanation: "keepEven" first retains [2,4]. Incrementing that stage's output produces [3,5].
Constraints
0 <= data.length <= 2000 <= operations.length <= 50-10^4 <= data[i] <= 10^4operations[i] is "double", "increment", "keepEven", or "keepPositive".- Every intermediate value fits in a signed 32-bit integer.
- At most
100 calls are made to transform.