hive-protolib/src/main/java/com/streamsets/pipeline/stage/lib/hive/HiveMetastoreUtil.java
private static <T> Field generateInnerFieldFromTheList(
      LinkedHashMap<String, T> original,
      String innerPairFirstFieldName,
      String innerPairSecondFieldName,
      boolean isSecondFieldHiveType
  ) throws HiveStageCheckedException {
    List<Field> columnList = new LinkedList<>();
    for(Map.Entry<String,T> pair:  original.entrySet()) {
      LinkedHashMap<String, Field> entry = new LinkedHashMap<>();
      entry.put(innerPairFirstFieldName, Field.create(pair.getKey()));
      if (isSecondFieldHiveType){
        HiveTypeInfo hiveTypeInfo = (HiveTypeInfo) pair.getValue();
        entry.put(
            innerPairSecondFieldName,
            hiveTypeInfo.getHiveType().getSupport().generateHiveTypeInfoFieldForMetadataRecord(hiveTypeInfo)
        );
      } else {
        entry.put(innerPairSecondFieldName, Field.create(pair.getValue().toString())); //stored value is "INT". need to fix this
      }
      columnList.add(Field.createListMap(entry));
    }
    return !columnList.isEmpty() ? Field.create(columnList) : null;
  }
private static <T> Field generateInnerFieldFromTheList(
      LinkedHashMap<String, T> original,
      String innerPairFirstFieldName,
      String innerPairSecondFieldName,
      boolean isSecondFieldHiveType
  ) throws HiveStageCheckedException {
    List<Field> columnList = new LinkedList<>();
    for(Map.Entry<String,T> pair:  original.entrySet()) {
      LinkedHashMap<String, Field> entry = new LinkedHashMap<>();
      entry.put(innerPairFirstFieldName, Field.create(pair.getKey()));
      if (isSecondFieldHiveType){
        HiveTypeInfo hiveTypeInfo = (HiveTypeInfo) pair.getValue();
        entry.put(
            innerPairSecondFieldName,
            hiveTypeInfo.getHiveType().getSupport().generateHiveTypeInfoFieldForMetadataRecord(hiveTypeInfo)
        );
      } else {
        entry.put(innerPairSecondFieldName, Field.create(pair.getValue().toString())); //stored value is "INT". need to fix this
      }
      columnList.add(Field.createListMap(entry));
    }
    return !columnList.isEmpty() ? Field.create(columnList) : null;
  }
private static < T > Field generateInnerFieldFromTheList ( LinkedHashMap < String , T > original , String innerPairFirstFieldName , String innerPairSecondFieldName , boolean isSecondFieldHiveType ) throws HiveStageCheckedException { List < Field > columnList = new LinkedList <> ( ) ; for ( Map . Entry < String , T > pair : original . entrySet ( ) ) { LinkedHashMap < String , Field > entry = new LinkedHashMap <> ( ) ; entry . put ( innerPairFirstFieldName , Field . create ( pair . getKey ( ) ) ) ; if ( isSecondFieldHiveType ) { HiveTypeInfo hiveTypeInfo = ( HiveTypeInfo ) pair . getValue ( ) ; entry . put ( innerPairSecondFieldName , hiveTypeInfo . getHiveType ( ) . getSupport ( ) . generateHiveTypeInfoFieldForMetadataRecord ( hiveTypeInfo ) ) ; } else { entry . put ( innerPairSecondFieldName , Field . create ( pair . getValue ( ) . toString ( ) ) ) ; //stored value is "INT". need to fix this } columnList . add ( Field . createListMap ( entry ) ) ; } return ! columnList . isEmpty ( ) ? Field . create ( columnList ) : null ; }
Opposite operation of extractInnerMapFromTheList.
It takes LinkedHashMap and generate a Field that contains the list.
This is to send metadata record to HMS target.
This function is called to for partition type list and partition value list.
Opposite operation of extractInnerMapFromTheList . It takes LinkedHashMap and generate a Field that contains the list . This is to send metadata record to HMS target . This function is called to for partition type list and partition value list .