felix.io
Class HadoopPostgreSQLPopulator

java.lang.Object
  extended by felix.io.HadoopPostgreSQLPopulator

public class HadoopPostgreSQLPopulator
extends java.lang.Object

Class for populating tables from files/directories generated with hadoop.

Author:
Ce Zhang

Constructor Summary
HadoopPostgreSQLPopulator()
           
 
Method Summary
static void createAndPopulateTable(java.lang.String schema, java.lang.String tableName, java.util.List<java.lang.String> columnNames, java.util.List<java.lang.String> columnTypes, java.lang.String filePath)
          Creates and populates the given schema.table from the given file.
static void createAndPopulateTableFromDir(java.lang.String schema, java.lang.String tableName, java.util.List<java.lang.String> columnNames, java.util.List<java.lang.String> columnTypes, java.lang.String dirPath, int nReducer)
          Creates and populates the given schema.table from the given directory.
static void dumpTableToHDFS(java.lang.String schema, java.lang.String tableName, int nColumn, java.lang.String filePath)
          Dumps given schema.table in to the given file.
static void main(java.lang.String[] args)
          Main test method.
static void populateTable(java.lang.String schema, java.lang.String tableName, java.util.List<java.lang.String> columnNames, java.util.List<java.lang.String> columnTypes, java.lang.String filePath)
          Populates the given schema.table from the given file.
static void populateTableFromDir(java.lang.String schema, java.lang.String tableName, java.util.List<java.lang.String> columnNames, java.util.List<java.lang.String> columnTypes, java.lang.String dirPath, int nReducer)
          Populates the given schema.table from the given directory.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HadoopPostgreSQLPopulator

public HadoopPostgreSQLPopulator()
Method Detail

dumpTableToHDFS

public static void dumpTableToHDFS(java.lang.String schema,
                                   java.lang.String tableName,
                                   int nColumn,
                                   java.lang.String filePath)
Dumps given schema.table in to the given file.

Parameters:
schema -
tableName -
nColumn -
filePath -

createAndPopulateTable

public static void createAndPopulateTable(java.lang.String schema,
                                          java.lang.String tableName,
                                          java.util.List<java.lang.String> columnNames,
                                          java.util.List<java.lang.String> columnTypes,
                                          java.lang.String filePath)
                                   throws java.lang.Exception
Creates and populates the given schema.table from the given file.

Parameters:
schema -
tableName -
columnNames -
columnTypes -
filePath -
Throws:
java.lang.Exception

populateTableFromDir

public static void populateTableFromDir(java.lang.String schema,
                                        java.lang.String tableName,
                                        java.util.List<java.lang.String> columnNames,
                                        java.util.List<java.lang.String> columnTypes,
                                        java.lang.String dirPath,
                                        int nReducer)
                                 throws java.lang.Exception
Populates the given schema.table from the given directory.

Parameters:
schema -
tableName -
columnNames -
columnTypes -
dirPath -
nReducer -
Throws:
java.lang.Exception

createAndPopulateTableFromDir

public static void createAndPopulateTableFromDir(java.lang.String schema,
                                                 java.lang.String tableName,
                                                 java.util.List<java.lang.String> columnNames,
                                                 java.util.List<java.lang.String> columnTypes,
                                                 java.lang.String dirPath,
                                                 int nReducer)
                                          throws java.lang.Exception
Creates and populates the given schema.table from the given directory.

Parameters:
schema -
tableName -
columnNames -
columnTypes -
dirPath -
nReducer -
Throws:
java.lang.Exception

populateTable

public static void populateTable(java.lang.String schema,
                                 java.lang.String tableName,
                                 java.util.List<java.lang.String> columnNames,
                                 java.util.List<java.lang.String> columnTypes,
                                 java.lang.String filePath)
                          throws java.lang.Exception
Populates the given schema.table from the given file.

Parameters:
schema -
tableName -
columnNames -
columnTypes -
filePath -
Throws:
java.lang.Exception

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Main test method.

Parameters:
args -
Throws:
java.lang.Exception