Ejemplo n.º 1
0
        /// <summary>Initializes the map-part of the job with the appropriate input settings.
        ///     </summary>
        /// <param name="job">The map-reduce job</param>
        /// <param name="inputClass">
        /// the class object implementing DBWritable, which is the
        /// Java object holding tuple fields.
        /// </param>
        /// <param name="inputQuery">
        /// the input query to select fields. Example :
        /// "SELECT f1, f2, f3 FROM Mytable ORDER BY f1"
        /// </param>
        /// <param name="inputCountQuery">
        /// the input query that returns
        /// the number of records in the table.
        /// Example : "SELECT COUNT(f1) FROM Mytable"
        /// </param>
        /// <seealso cref="DBInputFormat{T}.SetInput(Org.Apache.Hadoop.Mapreduce.Job, System.Type{T}, string, string, string, string[])
        ///     "/>
        public static void SetInput(Job job, Type inputClass, string inputQuery, string inputCountQuery
                                    )
        {
            job.SetInputFormatClass(typeof(DBInputFormat));
            DBConfiguration dbConf = new DBConfiguration(job.GetConfiguration());

            dbConf.SetInputClass(inputClass);
            dbConf.SetInputQuery(inputQuery);
            dbConf.SetInputCountQuery(inputCountQuery);
        }