Example #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="tableName">The table to read data from</param>
        /// <param name="conditions">
        /// The condition which to select data with,
        /// eg. '(updated &gt; 20070101 AND length &gt; 0)'
        /// </param>
        /// <param name="orderBy">the fieldNames in the orderBy clause.</param>
        /// <param name="fieldNames">The field names in the table</param>
        /// <seealso cref="DBInputFormat{T}.SetInput(Org.Apache.Hadoop.Mapreduce.Job, System.Type{T}, string, string)
        ///     "/>
        public static void SetInput(Job job, Type inputClass, string tableName, string conditions
                                    , string orderBy, params string[] fieldNames)
        {
            job.SetInputFormatClass(typeof(DBInputFormat));
            DBConfiguration dbConf = new DBConfiguration(job.GetConfiguration());

            dbConf.SetInputClass(inputClass);
            dbConf.SetInputTableName(tableName);
            dbConf.SetInputFieldNames(fieldNames);
            dbConf.SetInputConditions(conditions);
            dbConf.SetInputOrderBy(orderBy);
        }