Github user chiwanpark commented on a diff in the pull request: https://github.com/apache/flink/pull/1064#discussion_r38077826 --- Diff: flink-staging/flink-hcatalog/src/main/java/org/apache/flink/hcatalog/HCatOutputFormatBase.java --- @@ -0,0 +1,295 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.hcatalog; + +import org.apache.flink.api.common.io.FinalizeOnMaster; +import org.apache.flink.api.common.io.OutputFormat; +import org.apache.flink.api.common.typeinfo.BasicTypeInfo; +import org.apache.flink.api.common.typeinfo.PrimitiveArrayTypeInfo; +import org.apache.flink.api.common.typeinfo.TypeInformation; +import org.apache.flink.api.java.hadoop.mapreduce.utils.HadoopUtils; +import org.apache.flink.api.java.typeutils.GenericTypeInfo; +import org.apache.flink.api.java.typeutils.TupleTypeInfo; +import org.apache.hadoop.conf.Configurable; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.io.NullWritable; +import org.apache.hadoop.io.WritableComparable; +import org.apache.hadoop.mapred.JobConf; +import org.apache.hadoop.mapred.JobConfigurable; +import org.apache.hadoop.mapreduce.Job; +import org.apache.hadoop.mapreduce.JobContext; +import org.apache.hadoop.mapreduce.OutputCommitter; +import org.apache.hadoop.mapreduce.RecordWriter; +import org.apache.hadoop.mapreduce.TaskAttemptContext; +import org.apache.hadoop.mapreduce.TaskAttemptID; +import org.apache.hive.hcatalog.common.HCatUtil; +import org.apache.hive.hcatalog.data.HCatRecord; +import org.apache.hive.hcatalog.data.schema.HCatFieldSchema; +import org.apache.hive.hcatalog.data.schema.HCatSchema; +import org.apache.hive.hcatalog.mapreduce.OutputJobInfo; + +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.util.List; +import java.util.Map; + +public abstract class HCatOutputFormatBase<T> implements OutputFormat<T>, FinalizeOnMaster { + private static final long serialVersionUID = 1L; + + private Configuration configuration; + //a Job is used to create OutputJobInfo + private Job job; + + private org.apache.hive.hcatalog.mapreduce.HCatOutputFormat hCatOutputFormat; + private RecordWriter<WritableComparable<?>, HCatRecord> recordWriter; + + //required data type by the table + protected TypeInformation<T> reqType; + + protected String[] fieldNames = new String[0]; + protected HCatSchema outputSchema; + private transient TaskAttemptContext context; + private transient JobContext jobContext; + + + @Override + public void configure(org.apache.flink.configuration.Configuration parameters) { + // configure MR OutputFormat if necessary + if (this.hCatOutputFormat instanceof Configurable) { + ((Configurable) this.hCatOutputFormat).setConf(configuration); + } else if (this.hCatOutputFormat instanceof JobConfigurable) { + ((JobConfigurable) this.hCatOutputFormat).configure(new JobConf(configuration)); + } + } + + public HCatOutputFormatBase() { + } --- End diff -- Do we need a constructor without argument? It seems unnecessary.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---