public static Map<String,String> extractHiveTypeMapping(JobConf jobConf){
  Map<String,String> map=new HashMap<>();
  String columnsString=jobConf.get(serdeConstants.LIST_COLUMNS);
  if (columnsString == null || columnsString.isEmpty()) {
    LOG.warn("List of columns was not provided in job configuration");
    return map;
  }
  String[] columns=columnsString.split(",");
  String[] types=splitStructs(jobConf.get(serdeConstants.LIST_COLUMN_TYPES),',');
  if (types == null) {
    LOG.warn("Invalid input for LIST_COLUMN_TYPES");
    return map;
  }
  if (columns.length != types.length) {
    LOG.warn("Expected " + columns.length + " types but found "+ types.length);
    return map;
  }
  for (int i=0; i < columns.length; i++) {
    map.put(columns[i],types[i]);
  }
  LOG.debug("Hive columns to types mapping: " + map);
  return map;
}

public static Map < String , String > extractHiveTypeMapping ( JobConf jobConf ) { Map < String , String > map = new HashMap < > ( ) ; String columnsString = jobConf . get ( serdeConstants . LIST_COLUMNS ) ; if ( columnsString == null || columnsString . isEmpty ( ) ) { LOG . warn ( "List of columns was not provided in job configuration" ) ; return map ; } String [ ] columns = columnsString . split ( "," ) ; String [ ] types = splitStructs ( jobConf . get ( serdeConstants . LIST_COLUMN_TYPES ) , ',' ) ; if ( types == null ) { LOG . warn ( "Invalid input for LIST_COLUMN_TYPES" ) ; return map ; } if ( columns . length != types . length ) { LOG . warn ( "Expected " + columns . length + " types but found " + types . length ) ; return map ; } for ( int i = 0 ; i < columns . length ; i ++ ) { map . put ( columns [ i ] , types [ i ] ) ; } LOG . debug ( "Hive columns to types mapping: " + map ) ; return map ; }
extracts column to type mapping for the hive table from the job configuration it uses 2 standard hive job parameters : list_columns ( " columns " ) and list_column_types list_column_types ( " columns . types " ) .
