com.cloudera.sqoop.hive
Class TableDefWriter

java.lang.Object
  extended by com.cloudera.sqoop.hive.TableDefWriter

public class TableDefWriter
extends java.lang.Object

Creates (Hive-specific) SQL DDL statements to create tables to hold data we're importing from another source. After we import the database into HDFS, we can inject it into Hive using the CREATE TABLE and LOAD DATA INPATH statements generated by this object.


Field Summary
static org.apache.commons.logging.Log LOG
           
 
Constructor Summary
TableDefWriter(SqoopOptions opts, ConnManager connMgr, java.lang.String inputTable, java.lang.String outputTable, org.apache.hadoop.conf.Configuration config, boolean withComments)
          Creates a new TableDefWriter to generate a Hive CREATE TABLE statement.
 
Method Summary
 java.lang.String getCreateTableStmt()
           
 java.lang.String getLoadDataStmt()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public static final org.apache.commons.logging.Log LOG
Constructor Detail

TableDefWriter

public TableDefWriter(SqoopOptions opts,
                      ConnManager connMgr,
                      java.lang.String inputTable,
                      java.lang.String outputTable,
                      org.apache.hadoop.conf.Configuration config,
                      boolean withComments)
Creates a new TableDefWriter to generate a Hive CREATE TABLE statement.

Parameters:
opts - program-wide options
connMgr - the connection manager used to describe the table.
inputTable - the name of the table to load.
outputTable - the name of the Hive table to create.
config - the Hadoop configuration to use to connect to the dfs
withComments - if true, then tables will be created with a timestamp comment.
Method Detail

getCreateTableStmt

public java.lang.String getCreateTableStmt()
                                    throws java.io.IOException
Returns:
the CREATE TABLE statement for the table to load into hive.
Throws:
java.io.IOException

getLoadDataStmt

public java.lang.String getLoadDataStmt()
                                 throws java.io.IOException
Returns:
the LOAD DATA statement to import the data in HDFS into hive.
Throws:
java.io.IOException


Copyright © 2010 Cloudera, Inc.