<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Mapreduce and Hcatalog Integration fails to use MySql MetaStore in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Mapreduce-and-Hcatalog-Integration-fails-to-use-MySql/m-p/129245#M23017</link>
    <description>&lt;P&gt;&lt;STRONG&gt;Environment:&lt;/STRONG&gt; HDP 2.3 Sandbox&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Problem:&lt;/STRONG&gt;  I have created a table in hive with just 2 columns. Now i want to read this in my MR code using HCatalog integration. The MR Job fails to read the table from the MySql meta-store. It uses the Derby for some reason and hence it fails with "table not found" message.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Job Client code:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;public class HCatalogMRJob extends Configured implements Tool {

   public int run(String[] args) throws Exception {
        Configuration conf = getConf();
        args = new GenericOptionsParser(conf, args).getRemainingArgs();
        String inputTableName = args[0];
        String outputTableName = args[1];
        String dbName = null;
        Job job = new Job(conf, "HCatalogMRJob");
        HCatInputFormat.setInput(job, dbName, inputTableName);
        job.setInputFormatClass(HCatInputFormat.class);
        job.setJarByClass(HCatalogMRJob.class);
        job.setMapperClass(HCatalogMapper.class);
        job.setReducerClass(HCatalogReducer.class);
        job.setMapOutputKeyClass(IntWritable.class);
        job.setMapOutputValueClass(IntWritable.class);
        job.setOutputKeyClass(WritableComparable.class);
        job.setOutputValueClass(DefaultHCatRecord.class);
        HCatOutputFormat.setOutput(job, OutputJobInfo.create(dbName, outputTableName, null));
        HCatSchema s = HCatOutputFormat.getTableSchema(conf);
        System.err.println("INFO: output schema explicitly set for writing:"
                + s);
        HCatOutputFormat.setSchema(job, s);
        job.setOutputFormatClass(HCatOutputFormat.class);
        return (job.waitForCompletion(true) ? 0 : 1);
    }
    public static void main(String[] args) throws Exception {
        int exitCode = ToolRunner.run(new HCatalogMRJob(), args);
        System.exit(exitCode);
    }
}&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;Job Run Command:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;hadoop jar mr-hcat.jar input_table out_table&lt;/PRE&gt;&lt;P&gt;Before running this command, i have set the necessary hcatalog, hive jars in the class path using the hadoop_classpath variable.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Question:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Now, how do i make the job to use the hive-site.xml correctly?&lt;/P&gt;&lt;P&gt;I tried setting this in the classpath using the same hadoop_classpath as mentioned above., but still it fails.&lt;/P&gt;</description>
    <pubDate>Wed, 16 Mar 2016 04:26:32 GMT</pubDate>
    <dc:creator>learninghuman</dc:creator>
    <dc:date>2016-03-16T04:26:32Z</dc:date>
    <item>
      <title>Mapreduce and Hcatalog Integration fails to use MySql MetaStore</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Mapreduce-and-Hcatalog-Integration-fails-to-use-MySql/m-p/129245#M23017</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Environment:&lt;/STRONG&gt; HDP 2.3 Sandbox&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Problem:&lt;/STRONG&gt;  I have created a table in hive with just 2 columns. Now i want to read this in my MR code using HCatalog integration. The MR Job fails to read the table from the MySql meta-store. It uses the Derby for some reason and hence it fails with "table not found" message.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Job Client code:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;public class HCatalogMRJob extends Configured implements Tool {

   public int run(String[] args) throws Exception {
        Configuration conf = getConf();
        args = new GenericOptionsParser(conf, args).getRemainingArgs();
        String inputTableName = args[0];
        String outputTableName = args[1];
        String dbName = null;
        Job job = new Job(conf, "HCatalogMRJob");
        HCatInputFormat.setInput(job, dbName, inputTableName);
        job.setInputFormatClass(HCatInputFormat.class);
        job.setJarByClass(HCatalogMRJob.class);
        job.setMapperClass(HCatalogMapper.class);
        job.setReducerClass(HCatalogReducer.class);
        job.setMapOutputKeyClass(IntWritable.class);
        job.setMapOutputValueClass(IntWritable.class);
        job.setOutputKeyClass(WritableComparable.class);
        job.setOutputValueClass(DefaultHCatRecord.class);
        HCatOutputFormat.setOutput(job, OutputJobInfo.create(dbName, outputTableName, null));
        HCatSchema s = HCatOutputFormat.getTableSchema(conf);
        System.err.println("INFO: output schema explicitly set for writing:"
                + s);
        HCatOutputFormat.setSchema(job, s);
        job.setOutputFormatClass(HCatOutputFormat.class);
        return (job.waitForCompletion(true) ? 0 : 1);
    }
    public static void main(String[] args) throws Exception {
        int exitCode = ToolRunner.run(new HCatalogMRJob(), args);
        System.exit(exitCode);
    }
}&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;Job Run Command:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;hadoop jar mr-hcat.jar input_table out_table&lt;/PRE&gt;&lt;P&gt;Before running this command, i have set the necessary hcatalog, hive jars in the class path using the hadoop_classpath variable.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Question:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Now, how do i make the job to use the hive-site.xml correctly?&lt;/P&gt;&lt;P&gt;I tried setting this in the classpath using the same hadoop_classpath as mentioned above., but still it fails.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2016 04:26:32 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Mapreduce-and-Hcatalog-Integration-fails-to-use-MySql/m-p/129245#M23017</guid>
      <dc:creator>learninghuman</dc:creator>
      <dc:date>2016-03-16T04:26:32Z</dc:date>
    </item>
    <item>
      <title>Re: Mapreduce and Hcatalog Integration fails to use MySql MetaStore</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Mapreduce-and-Hcatalog-Integration-fails-to-use-MySql/m-p/129246#M23018</link>
      <description>&lt;P&gt;Issue resolved by setting /etc/hive/conf in the classpath Instead of /etc/hive/conf/*.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2016 03:26:21 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Mapreduce-and-Hcatalog-Integration-fails-to-use-MySql/m-p/129246#M23018</guid>
      <dc:creator>learninghuman</dc:creator>
      <dc:date>2016-03-17T03:26:21Z</dc:date>
    </item>
  </channel>
</rss>

