Exemple #1
0
        /// <summary>Initializes the map-part of the job with the appropriate input settings.
        ///     </summary>
        /// <param name="job">The 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.Mapred.JobConf, System.Type{T}, string, string, string, string[])
        ///     "/>
        public static void SetInput(JobConf job, Type inputClass, string inputQuery, string
                                    inputCountQuery)
        {
            job.SetInputFormat(typeof(DBInputFormat));
            DBConfiguration dbConf = new DBConfiguration(job);

            dbConf.SetInputClass(inputClass);
            dbConf.SetInputQuery(inputQuery);
            dbConf.SetInputCountQuery(inputCountQuery);
        }
Exemple #2
0
        /// <summary>Initializes the map-part of the job with the appropriate input settings.
        ///     </summary>
        /// <param name="job">The 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.Mapred.JobConf, System.Type{T}, string, string)
        ///     "/>
        public static void SetInput(JobConf job, Type inputClass, string tableName, string
                                    conditions, string orderBy, params string[] fieldNames)
        {
            job.SetInputFormat(typeof(DBInputFormat));
            DBConfiguration dbConf = new DBConfiguration(job);

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