About Me

Prospects, This is the Only place Where YOu can Find All Interview questions,Faqs and Real Stuff and scenario & Scripts with Resumes, Stick to It for Updates,,,,

Sunday, March 16, 2008

PROCESSING STAGE



Change Apply Stage

The Change Apply stage is an active stage. It takes the change data set, that contains the changes in the before and after data sets, from the Change Capture stage and applies the encoded change operations to a before data set to compute an after data set. An example before and change data set are given in Parallel Job Developer's Guide. Follow this link for a list of steps you must take when deploying a Change Apply stage in your job.

The before input to Change Apply must have the same columns as the before input that was input to Change Capture, and an automatic conversion must exist between the types of corresponding columns. In addition, results are only guaranteed if the contents of the before input to Change Apply are identical (in value and record order in each partition) to the before input that was fed to Change Capture, and if the keys are unique.

The change input to Change Apply must have been output from Change Capture without modification. Because preserve-partitioning is set on the change output of Change Capture, you will be warned at run time if the Change Apply stage does not have the same number of partitions as the Change Capture stage. Additionally, both inputs of Change Apply are designated as partitioned using the Same partitioning method.

The Change Apply stage read a record from the change data set and from the before data set, compares their key column values, and acts accordingly:

· If the before keys come before the change keys in the specified sort order, the before record is copied to the output. The change record is retained for the next comparison.

· If the before keys are equal to the change keys, the behavior depends on the code in the change_code column of the change record:

· Insert: The change record is copied to the output; the stage retains the same before record for the next comparison.. If key columns are not unique, and there is more than one consecutive insert with the same key, then Change Apply applies all the consecutive inserts before existing records. This record order may be different from the after data set given to Change Capture.

· Delete: The value columns of the before and change records are compared. If the value columns are the same or if the Check Value Columns on Delete is specified as False, the change and before records are both discarded; no record is transferred to the output. If the value columns are not the same, the before record is copied to the output and the stage retains the same change record for the next comparison.
If key columns are not unique, the value columns ensure that the correct record is deleted. If more than one record with the same keys have matching value columns, the first-encountered record is deleted. This may cause different record ordering than in the after data set given to the Change Capture stage. A warning is issued and both change record and before record are discarded, i.e. no output record results.

· Edit: The change record is copied to the output; the before record is discarded. If key columns are not unique, then the first before record encountered with matching keys will be edited. This may be a different record from the one that was edited in the after data set given to the Change Capture stage. A warning is issued and the change record is copied to the output; but the stage retains the same before record for the next comparison..

· Copy: The change record is discarded. The before record is copied to the output.

· If the before keys come after the change keys, behavior also depends on the change_code column:.

· Insert. The change record is copied to the output, the stage retains the same before record for the next comparison. (The same as when the keys are equal.)

· Delete. A warning is issued and the change record discarded while the before record is retained for the next comparison.

· Edit or Copy. A warning is issued and the change record is copied to the output while the before record is retained for the next comparison.

If the before input of Change Apply is identical to the before input of Change Capture and either the keys are unique or copy records are used, then the output of Change Apply is identical to the after input of Change Capture. However, if the before input of Change Apply is not the same (different record contents or ordering), or the keys are not unique and copy records are not used, this is not detected and the rules described above are applied anyway, producing a result that might or might not be useful.


0 comments: