Review Board 1.7.22


Fix for SQOOP-988

Review Request #10549 - Created April 16, 2013 and updated

Venkat Ranganathan
Reviewers
Sqoop
jarcec
sqoop-trunk
Changes to write a message about the validation being performed and on successful validation, a message that validation was successful
Ran all tests and also some validation tests.   Output similar to the following will be provided for validation

13/04/16 07:28:21 INFO mapreduce.JobBase: Validating the integrity of the import using the following configuration
	Validator : org.apache.sqoop.validation.RowCountValidator
	Threshold Specifier : org.apache.sqoop.validation.AbsoluteValidationThreshold
	Failure Handler : org.apache.sqoop.validation.AbortOnFailureHandler

13/04/16 07:28:21 INFO validation.RowCountValidator: Data successfully validated
src/java/com/cloudera/sqoop/mapreduce/JobBase.java
Revision b89612d New Change
[20] 15 lines
[+20]
16
 * limitations under the License.
16
 * limitations under the License.
17
 */
17
 */
18

    
   
18

   
19
package com.cloudera.sqoop.mapreduce;
19
package com.cloudera.sqoop.mapreduce;
20

    
   
20

   

    
   
21
import java.io.IOException;

    
   
22
import java.sql.SQLException;

    
   
23

   
21
import org.apache.hadoop.conf.Configuration;
24
import org.apache.hadoop.conf.Configuration;
22
import org.apache.hadoop.mapreduce.InputFormat;
25
import org.apache.hadoop.mapreduce.InputFormat;
23
import org.apache.hadoop.mapreduce.Job;
26
import org.apache.hadoop.mapreduce.Job;
24
import org.apache.hadoop.mapreduce.Mapper;
27
import org.apache.hadoop.mapreduce.Mapper;
25
import org.apache.hadoop.mapreduce.OutputFormat;
28
import org.apache.hadoop.mapreduce.OutputFormat;
26
import com.cloudera.sqoop.SqoopOptions;

   
27
import org.apache.hadoop.util.ReflectionUtils;
29
import org.apache.hadoop.util.ReflectionUtils;
28
import org.apache.sqoop.config.ConfigurationHelper;
30
import org.apache.sqoop.config.ConfigurationHelper;
29
import org.apache.sqoop.manager.ConnManager;
31
import org.apache.sqoop.manager.ConnManager;
30
import org.apache.sqoop.validation.*;
32
import org.apache.sqoop.validation.ValidationContext;

    
   
33
import org.apache.sqoop.validation.ValidationException;

    
   
34
import org.apache.sqoop.validation.ValidationFailureHandler;

    
   
35
import org.apache.sqoop.validation.ValidationThreshold;

    
   
36
import org.apache.sqoop.validation.Validator;
31

    
   
37

   
32
import java.io.IOException;
38
import com.cloudera.sqoop.SqoopOptions;
33
import java.sql.SQLException;

   
34

    
   
39

   
35
/**
40
/**
36
 * @deprecated Moving to use org.apache.sqoop namespace.
41
 * @deprecated Moving to use org.apache.sqoop namespace.
37
 */
42
 */

    
   
43
@Deprecated
38
public class JobBase
44
public class JobBase
39
    extends org.apache.sqoop.mapreduce.JobBase {
45
    extends org.apache.sqoop.mapreduce.JobBase {
40

    
   
46

   
41
  public JobBase() {
47
  public JobBase() {
42
    super();
48
    super();
[+20] [20] 30 lines
[+20] [+] protected void doValidate(SqoopOptions options, Configuration conf,
73
          conf);
79
          conf);
74
    ValidationFailureHandler failureHandler = (ValidationFailureHandler)
80
    ValidationFailureHandler failureHandler = (ValidationFailureHandler)
75
        ReflectionUtils.newInstance(options.getValidationFailureHandlerClass(),
81
        ReflectionUtils.newInstance(options.getValidationFailureHandlerClass(),
76
          conf);
82
          conf);
77

    
   
83

   

    
   
84
    StringBuilder sb = new StringBuilder();

    
   
85
    sb.append("Validating the integrity of the import using the "

    
   
86
      + "following configuration\n");

    
   
87
    sb.append("\tValidator : ").append(validator.getClass().getName())

    
   
88
      .append('\n');

    
   
89
    sb.append("\tThreshold Specifier : ")

    
   
90
      .append(threshold.getClass().getName()).append('\n');

    
   
91
    sb.append("\tFailure Handler : ")

    
   
92
      .append(failureHandler.getClass().getName()).append('\n');

    
   
93
    LOG.info(sb.toString());
78
    validator.validate(validationContext, threshold, failureHandler);
94
    validator.validate(validationContext, threshold, failureHandler);
79
  }
95
  }
80
}
96
}
src/java/org/apache/sqoop/validation/RowCountValidator.java
Revision ca21232 New Change
 
  1. src/java/com/cloudera/sqoop/mapreduce/JobBase.java: Loading...
  2. src/java/org/apache/sqoop/validation/RowCountValidator.java: Loading...