io.cdap.cdap.internal.app.runtime.batch.dataset.input.MultipleInputs Maven / Gradle / Ivy
/*
* Copyright © 2016 Cask Data, Inc.
*
* Licensed 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 io.cdap.cdap.internal.app.runtime.batch.dataset.input;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.mapreduce.InputFormat;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.Map;
/**
* This utility class supports MapReduce jobs that have multiple inputs with
* a different {@link InputFormat} and {@link Mapper} for each path
*/
public final class MultipleInputs {
private static final String INPUT_CONFIGS = "mapreduce.input.multipleinputs.inputs";
private static final Gson GSON = new GsonBuilder().enableComplexMapKeySerialization().create();
private static final Type STRING_MAPPER_INPUT_MAP_TYPE = new TypeToken