prathyush17 commented on code in PR #7177:
URL: https://github.com/apache/hbase/pull/7177#discussion_r2245198906


##########
hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableOutputFormat.java:
##########
@@ -252,7 +262,18 @@ public void checkOutputSpecs(JobContext context) throws 
IOException, Interrupted
   @Override
   public OutputCommitter getOutputCommitter(TaskAttemptContext context)
     throws IOException, InterruptedException {
-    return new TableOutputCommitter();
+    Configuration hConf = getConf();
+    if (hConf == null) {
+      hConf = context.getConfiguration();
+    }
+
+    try {
+      Class<? extends OutputCommitter> outputCommitter = 
hConf.getClass(OUTPUT_COMMITTER_CLASS,
+        TableOutputCommitter.class, OutputCommitter.class);
+      return ReflectionUtils.newInstance(outputCommitter);

Review Comment:
   The no-args constructor approach is consistent with Hadoop's OutputCommitter 
pattern for example: FileOutputCommitter (which follows similar pattern). 
Reflection-based approach with no-args constructor is simpler and sufficient 
since custom implementations can access configuration/context through the 
required OutputCommitter methods (setupJob, setupTask etc).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to