hive-protolib/src/main/java/com/streamsets/pipeline/stage/lib/hive/HiveMetastoreUtil.java
public static Field newPartitionMetadataFieldBuilder(
      String database,
      String tableName,
      LinkedHashMap<String, String> partitionList,
      String location,
      boolean customLocation,
      HMPDataFormat dataFormat) throws HiveStageCheckedException {
    LinkedHashMap<String, Field> metadata = new LinkedHashMap<>();
    metadata.put(VERSION, Field.create(PARTITION_ADDITION_METADATA_RECORD_VERSION));
    metadata.put(METADATA_RECORD_TYPE, Field.create(MetadataRecordType.PARTITION.name()));
    metadata.put(DATABASE_FIELD, Field.create(database));
    metadata.put(TABLE_FIELD, Field.create(tableName));
    metadata.put(LOCATION_FIELD, Field.create(location));
    metadata.put(CUSTOM_LOCATION, Field.create(customLocation));
    metadata.put(DATA_FORMAT, Field.create(dataFormat.name()));

    //fill in the partition list here
    metadata.put(
        PARTITION_FIELD,
        generateInnerFieldFromTheList(
            partitionList,
            PARTITION_NAME,
            PARTITION_VALUE,
            false
        )
    );
    return Field.createListMap(metadata);
  }
public static Field newPartitionMetadataFieldBuilder(
      String database,
      String tableName,
      LinkedHashMap<String, String> partitionList,
      String location,
      boolean customLocation,
      HMPDataFormat dataFormat) throws HiveStageCheckedException {
    LinkedHashMap<String, Field> metadata = new LinkedHashMap<>();
    metadata.put(VERSION, Field.create(PARTITION_ADDITION_METADATA_RECORD_VERSION));
    metadata.put(METADATA_RECORD_TYPE, Field.create(MetadataRecordType.PARTITION.name()));
    metadata.put(DATABASE_FIELD, Field.create(database));
    metadata.put(TABLE_FIELD, Field.create(tableName));
    metadata.put(LOCATION_FIELD, Field.create(location));
    metadata.put(CUSTOM_LOCATION, Field.create(customLocation));
    metadata.put(DATA_FORMAT, Field.create(dataFormat.name()));

    //fill in the partition list here
    metadata.put(
        PARTITION_FIELD,
        generateInnerFieldFromTheList(
            partitionList,
            PARTITION_NAME,
            PARTITION_VALUE,
            false
        )
    );
    return Field.createListMap(metadata);
  }
public static Field newPartitionMetadataFieldBuilder ( String database , String tableName , LinkedHashMap < String , String > partitionList , String location , boolean customLocation , HMPDataFormat dataFormat ) throws HiveStageCheckedException { LinkedHashMap < String , Field > metadata = new LinkedHashMap <> ( ) ; metadata . put ( VERSION , Field . create ( PARTITION_ADDITION_METADATA_RECORD_VERSION ) ) ; metadata . put ( METADATA_RECORD_TYPE , Field . create ( MetadataRecordType . PARTITION . name ( ) ) ) ; metadata . put ( DATABASE_FIELD , Field . create ( database ) ) ; metadata . put ( TABLE_FIELD , Field . create ( tableName ) ) ; metadata . put ( LOCATION_FIELD , Field . create ( location ) ) ; metadata . put ( CUSTOM_LOCATION , Field . create ( customLocation ) ) ; metadata . put ( DATA_FORMAT , Field . create ( dataFormat . name ( ) ) ) ; //fill in the partition list here metadata . put ( PARTITION_FIELD , generateInnerFieldFromTheList ( partitionList , PARTITION_NAME , PARTITION_VALUE , false ) ) ; return Field . createListMap ( metadata ) ; }
Fill in metadata to Record. This is for new partition creation.
Use the {@code customLocation} flag to mark whether the {@code location} is a custom one or the default location
used by Hive.
Fill in metadata to Record . This is for new partition creation . Use the {