Using a Global Address Validation MapReduce Job
-
Create an instance of
AddressValidationFactory
, using its static methodgetInstance()
. -
Provide the input and output details for the Global Address Validation job by
creating an instance of
AddressValidationDetail
specifying theProcessType
. The instance must use the type MRProcessType. For this, the steps are:-
Create an instance of
productDatabaseInfo
, and set these details:- ReferenceDataPath: Use Enum ReferenceDataPathLocation
- CountryCode: Use Enum CountryCodes
- ProcessType: Use Enum AddressValidationProcessType
-
Create an array list class
ProductDatabaseInfoList
and use the add() method to insert theProductDatabaseInfo
. -
Create an instance of
AddressValidationEngineConfiguration
, and in this instance, set theProductDatabaseInfoList
. -
Create an instance of
AddressValidationInputOption
, and set these details to this new instance:Note: Use these enums: Enum AddressValidationInputOption.MatchMode, Enum CountryCodes, and Enum Casing.- Casing
- MatchMode
- DefaultCountry
- MaximumResults
- ReturnInputAddress
- ReturnParsedAddress
- ReturnPrecisionCode
- ReturnMatchScore
- MustMatchAddressNumber
- MustMatchStreet
- MustMatchCity
- MustMatchLocality
- MustMatchState
- MustMatchStateProvince
- MustMatchPostCode
- KeepMultiMatch
- PreferPostalOverCity
- CityFallback
- PostalFallback
- ValidationLevel
-
Create an instance of
AddressValidationDetail
, by passing the job configuration,addressValidationEngineConfiguration
, andinputOption
instance created earlier as the arguments to its constructor. To this instance, set these details:Note: TheConfig
parameter must be an instance of type MRJobConfig (for an MR job) and SparkJobConfig (for a Spark job).- Set the details of the input file using the
inputPath
field.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 ofOrcFilePath
with the path of the ORC input file as the argument. - Set the details of the output file using the
outputPath
field.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 ofOrcFilePath
with the path of the ORC output file as the argument. - Set the name of the job using the
jobName
field. - Set the
compressOutput
flag to false to prevent compressing the output of the job.
- Set the details of the input file using the
-
Create an instance of
-
To create a MapReduce job, use the previously created instance of
AddressValidationFactory
to invoke its methodcreateJob()
. In this, pass the above instance ofAddressValidationDetail
as an argument.ThecreateJob()
method returns aList
of instances ofControlledJob
. -
Run the created job using an instance of
JobControl
. -
To display the reporting counters post a successful MapReduce job run, use the
previously created instance of
AddressValidationFactory
to invoke its methodgetCounters()
, passing the created job as an argument.