package com.thinkaurelius.titan.hadoop.formats.titan;

import com.thinkaurelius.titan.diskstorage.configuration.ConfigOption;
import com.thinkaurelius.titan.hadoop.FaunusVertex;
import com.thinkaurelius.titan.hadoop.Holder;
import com.thinkaurelius.titan.hadoop.compat.HadoopCompiler;
import com.thinkaurelius.titan.hadoop.config.ModifiableHadoopConfiguration;
import com.thinkaurelius.titan.hadoop.config.TitanHadoopConfiguration;
import com.thinkaurelius.titan.hadoop.formats.MapReduceFormat;
import com.thinkaurelius.titan.hadoop.formats.noop.NoOpOutputFormat;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;

import static com.thinkaurelius.titan.hadoop.compat.HadoopCompatLoader.DEFAULT_COMPAT;

/**
 * @author Marko A. Rodriguez (http://markorodriguez.com)
 */
public abstract class TitanOutputFormat extends NoOpOutputFormat implements MapReduceFormat {

    public static final ConfigOption<Boolean> INFER_SCHEMA = new ConfigOption<Boolean>(
            TitanHadoopConfiguration.OUTPUT_NS, "infer-schema",
            "Whether to attempt to automatically create Titan property keys and labels before writing data",
            ConfigOption.Type.LOCAL, true);

    @Override
    public void addMapReduceJobs(final HadoopCompiler compiler) {

        final boolean inferSchema =
                ModifiableHadoopConfiguration.of(compiler.getConf()).get(INFER_SCHEMA);

        if (inferSchema) {
            compiler.addMapReduce(SchemaInferencerMapReduce.Map.class,
                    null,
                    SchemaInferencerMapReduce.Reduce.class,
                    LongWritable.class,
                    FaunusVertex.class,
                    NullWritable.class,
                    FaunusVertex.class,
                    SchemaInferencerMapReduce.createConfiguration());
        }

        Configuration outputConf = compiler.getConf();

        outputConf.setBoolean(DEFAULT_COMPAT.getSpeculativeMapConfigKey(), false);
        outputConf.setBoolean(DEFAULT_COMPAT.getSpeculativeReduceConfigKey(), false);

        compiler.addMapReduce(TitanGraphOutputMapReduce.VertexMap.class,
                null,
                TitanGraphOutputMapReduce.Reduce.class,
                LongWritable.class,
                Holder.class,
                NullWritable.class,
                FaunusVertex.class,
                outputConf);
        compiler.addMap(TitanGraphOutputMapReduce.EdgeMap.class,
                NullWritable.class,
                FaunusVertex.class,
                outputConf);
    }
}

@@ -940,315 +940,8 @@
 t %7B%0A
-%0A    public static final ConfigOption%3CBoolean%3E INFER_SCHEMA = new ConfigOption%3CBoolean%3E(%0A            TitanHadoopConfiguration.OUTPUT_NS, %22infer-schema%22,%0A            %22Whether to attempt to automatically create Titan property keys and labels before writing data%22,%0A            ConfigOption.Type.LOCAL, true);%0A%0A
     
@@ -1053,16 +1053,16 @@
 chema =%0A
-
         
@@ -1126,16 +1126,48 @@
 ()).get(
+TitanHadoopConfiguration.OUTPUT_
 INFER_SC

Fix accidental double-definition of INFER_SCHEMA