Example usage for org.apache.hadoop.mapred.lib.db DBInputFormat setInput

List of usage examples for org.apache.hadoop.mapred.lib.db DBInputFormat setInput

Introduction

In this page you can find the example usage for org.apache.hadoop.mapred.lib.db DBInputFormat setInput.

Prototype

public static void setInput(JobConf job, Class<? extends DBWritable> inputClass, String inputQuery,
        String inputCountQuery) 

Source Link

Document

Initializes the map-part of the job with the appropriate input settings.

Usage

From source file:co.nubetech.apache.hadoop.mapred.DataDrivenDBInputFormat.java

License:Apache License

/**
 * setInput() takes a custom query and a separate "bounding query" to use
 * instead of the custom "count query" used by DBInputFormat.
 *//*from   w  ww.j  av a2s . co m*/
public static void setInput(Job job, Class<? extends DBWritable> inputClass, String inputQuery,
        String inputBoundingQuery) {
    DBInputFormat.setInput(job, inputClass, inputQuery, "");
    job.getConfiguration().set(DBConfiguration.INPUT_BOUNDING_QUERY, inputBoundingQuery);
    job.setInputFormatClass(DataDrivenDBInputFormat.class);
}

From source file:co.nubetech.apache.hadoop.mapred.DBQueryInputFormat.java

License:Apache License

/**
 * setInput() takes a custom query and a separate "bounding query" to use
 * instead of the custom "count query" used by DBInputFormat.
 *///from  w w  w.java 2 s.c o m
public static void setInput(JobConf job, String inputQuery, String inputBoundingQuery, ArrayList params)
        throws IOException {
    DBInputFormat.setInput(job, GenericDBWritable.class, inputQuery, "");

    if (inputBoundingQuery != null) {
        job.set(DBConfiguration.INPUT_BOUNDING_QUERY, inputBoundingQuery);
    }
    if (params != null) {
        DefaultStringifier<ArrayList> stringifier = new DefaultStringifier<ArrayList>(job, ArrayList.class);
        job.set(HIHOConf.QUERY_PARAMS, stringifier.toString(params));
        logger.debug("Converted params and saved them into config");
    }
    job.setInputFormat(DBQueryInputFormat.class);
}