Using a Best of Breed Spark Job
-
Create an instance of
AdvanceMatchFactory
, using its static methodgetInstance()
. -
Provide the input and output details for the Best of Breed job by creating an
instance of
BestofBreedDetail
specifying theProcessType
. The instance must use the type SparkProcessType.-
Specify the column using which the records are to be grouped by
creating an instance of
GroupbyOption
.Use an instance of GroupbySparkOption to specify the group-by column. -
Generate the consolidation and template rules for the job by creating
an instance of
BestOfBreedConfiguration
. Within this instance:- Define the template record for the consolidation using an
instance of
ConsolidationCondition
, which comprises ofConsolidationRule
instances. - Define the consolidation conditions
using instances of
ConsolidationCondition
, and connecting the conditions using logical operators.Each instance of
ConsolidationCondition
is defined using aConsolidationRule
instance and its correspondingConsolidationAction
instance.
Note: Each instance ofConsolidationRule
can be defined either using a single instance ofSimpleRule
, or using a hierarchy of childSimpleRule
instances and nestedConjoinedRule
instances joined using logical operators. See Enum JoinType and Enum Operation. - Define the template record for the consolidation using an
instance of
-
Create an instance of
BestofBreedDetail
, by passing an instance of typeJobConfig
, theGroupbyOption
instance created, and theBestOfBreedConfiguration
instance created above as the arguments to its constructor.TheJobConfig
parameter must be an instance of type SparkJobConfig. -
Set the details of the input file using the
inputPath
field of theBestofBreedDetail
instance.- For a text input file, create an instance of
FilePath
with the relevant details of the input file by invoking the appropriate constructor. - For an ORC input file, create an instance of
OrcFilePath
with the path of the ORC input file as the argument. - For a Parquet input file, create an instance of ParquetFilePath with the path of the Parquet input file as the argument.
- For a text input file, create an instance of
-
Set the details of the output file using the
outputPath
field of theBestofBreedDetail
instance.- For a text output file, create an instance of
FilePath
with the relevant details of the output file by invoking the appropriate constructor. - For an ORC output file, create an instance of
OrcFilePath
with the path of the ORC output file as the argument. - For a Parquet output file, create an instance of ParquetFilePath with the path of the Parquet output file as the argument.
- For a text output file, create an instance of
-
Set the name of the job using the
jobName
field of theBestofBreedDetail
instance. -
Set the
compressOutput
flag of theBestofBreedDetail
instance to true to compress the output of the job.
-
Specify the column using which the records are to be grouped by
creating an instance of
-
To create and run the Spark job, use the previously created instance of
AdvanceMatchFactory
to invoke its methodrunSparkJob()
. In this, pass the above instance ofBestofBreedDetail
as an argument.TherunSparkJob()
method runs the job and returns aMap
of the reporting counters of the job. - Display the counters to view the reporting statistics for the job.