Index: src/java/org/apache/hcatalog/mapreduce/HCatBaseInputFormat.java =================================================================== --- src/java/org/apache/hcatalog/mapreduce/HCatBaseInputFormat.java (revision 1297783) +++ src/java/org/apache/hcatalog/mapreduce/HCatBaseInputFormat.java (working copy) @@ -151,7 +151,8 @@ HCatUtil.copyJobPropertiesToJobConf(jobProperties, jobConf); - storageHandler = partitionInfo.getStorageHandler(); + storageHandler = HCatUtil.getStorageHandler( + jobConf, partitionInfo); //Get the input format Class inputFormatClass = storageHandler.getInputFormatClass(); @@ -194,7 +195,9 @@ PartInfo partitionInfo = hcatSplit.getPartitionInfo(); JobContext jobContext = taskContext; - HCatStorageHandler storageHandler = partitionInfo.getStorageHandler(); + HCatStorageHandler storageHandler = HCatUtil.getStorageHandler( + jobContext.getConfiguration(), partitionInfo); + JobConf jobConf = HCatUtil.getJobConfFromContext(jobContext); Class inputFormatClass = storageHandler.getInputFormatClass(); Index: src/java/org/apache/hcatalog/mapreduce/FosterStorageHandler.java =================================================================== --- src/java/org/apache/hcatalog/mapreduce/FosterStorageHandler.java (revision 1297783) +++ src/java/org/apache/hcatalog/mapreduce/FosterStorageHandler.java (working copy) @@ -30,11 +30,9 @@ * artifacts of tables which don't define a SerDe. This StorageHandler assumes * the supplied storage artifacts are for a file-based storage system. */ -public class FosterStorageHandler extends HCatStorageHandler - implements Serializable { +public class FosterStorageHandler extends HCatStorageHandler { - public Configuration conf - ; + public Configuration conf; /** The directory under which data is initially written for a partitioned table */ protected static final String DYNTEMP_DIR_NAME = "_DYN"; Index: src/java/org/apache/hcatalog/mapreduce/PartInfo.java =================================================================== --- src/java/org/apache/hcatalog/mapreduce/PartInfo.java (revision 1297783) +++ src/java/org/apache/hcatalog/mapreduce/PartInfo.java (working copy) @@ -37,7 +37,10 @@ private final HCatSchema partitionSchema; /** The information about which input storage handler to use */ - private final HCatStorageHandler storageHandler; + private final String storageHandlerClassName; + private final String inputFormatClassName; + private final String outputFormatClassName; + private final String serdeClassName; /** HCat-specific properties set at the partition */ private final Properties hcatProperties; @@ -65,13 +68,17 @@ String location, Properties hcatProperties, Map jobProperties, HCatTableInfo tableInfo){ this.partitionSchema = partitionSchema; - this.storageHandler = storageHandler; this.location = location; this.hcatProperties = hcatProperties; this.jobProperties = jobProperties; this.tableInfo = tableInfo; - } + this.storageHandlerClassName = storageHandler.getClass().getName(); + this.inputFormatClassName = storageHandler.getInputFormatClass().getName(); + this.serdeClassName = storageHandler.getSerDeClass().getName(); + this.outputFormatClassName = storageHandler.getOutputFormatClass().getName(); +} + /** * Gets the value of partitionSchema. * @return the partitionSchema @@ -80,17 +87,35 @@ return partitionSchema; } + /** + * @return the storage handler class name + */ + public String getStorageHandlerClassName() { + return storageHandlerClassName; + } /** - * Gets the value of input storage driver class name. - * @return the input storage driver class name + * @return the inputFormatClassName */ - public HCatStorageHandler getStorageHandler() { - return storageHandler; + public String getInputFormatClassName() { + return inputFormatClassName; } + /** + * @return the outputFormatClassName + */ + public String getOutputFormatClassName() { + return outputFormatClassName; + } /** + * @return the serdeClassName + */ + public String getSerdeClassName() { + return serdeClassName; + } + + /** * Gets the value of hcatProperties. * @return the hcatProperties */ Index: src/java/org/apache/hcatalog/common/HCatUtil.java =================================================================== --- src/java/org/apache/hcatalog/common/HCatUtil.java (revision 1297783) +++ src/java/org/apache/hcatalog/common/HCatUtil.java (working copy) @@ -74,6 +74,7 @@ import org.apache.hcatalog.mapreduce.HCatStorageHandler; import org.apache.hcatalog.mapreduce.InputJobInfo; import org.apache.hcatalog.mapreduce.OutputJobInfo; +import org.apache.hcatalog.mapreduce.PartInfo; import org.apache.hcatalog.mapreduce.StorerInfo; import org.apache.thrift.TException; @@ -477,6 +478,15 @@ storerInfo.getIfClass(), storerInfo.getOfClass()); } + + public static HCatStorageHandler getStorageHandler(Configuration conf, PartInfo partitionInfo) throws IOException { + return HCatUtil.getStorageHandler( + conf, + partitionInfo.getStorageHandlerClassName(), + partitionInfo.getSerdeClassName(), + partitionInfo.getInputFormatClassName(), + partitionInfo.getOutputFormatClassName()); + } /** * Create an instance of a storage handler. If storageHandler == null, @@ -497,7 +507,7 @@ String outputFormat) throws IOException { - if (storageHandler == null) { + if ((storageHandler == null) || (storageHandler.equals(FosterStorageHandler.class.getName()))){ try { return new FosterStorageHandler(inputFormat, outputFormat,