Class AddPartition


  • public class AddPartition
    extends Command
    A class for the AddPartition command
    Author:
    wwong
    • Constructor Detail

      • AddPartition

        public AddPartition​(org.apache.hadoop.hive.metastore.events.AddPartitionEvent addPartitionEvent,
                            SnowflakeConf snowflakeConf)
        Creates an AddPartition command
        Parameters:
        addPartitionEvent - Event to generate a command from
        snowflakeConf - - the configuration for Snowflake Hive metastore listener
      • AddPartition

        public AddPartition​(org.apache.hadoop.hive.metastore.events.AlterPartitionEvent alterPartitionEvent,
                            SnowflakeConf snowflakeConf)
        Creates an AddPartition command
        Parameters:
        alterPartitionEvent - Event to generate a command from
        snowflakeConf - - the configuration for Snowflake Hive metastore listener
      • AddPartition

        public AddPartition​(org.apache.hadoop.hive.metastore.api.Table hiveTable,
                            Iterator<org.apache.hadoop.hive.metastore.api.Partition> partitionsIterator,
                            SnowflakeConf snowflakeConf,
                            org.apache.hadoop.conf.Configuration hiveConf,
                            boolean isCompact)
        Creates an AddPartition command without an event
        Parameters:
        hiveTable - The Hive table to generate a command from
        partitionsIterator - A method that supplies an iterator for partitions to add
        snowflakeConf - - the configuration for Snowflake Hive metastore listener
        hiveConf - The Hive configuration
        isCompact - internal marker to check if this command was generated by compaction
    • Method Detail

      • compact

        public static List<AddPartition> compact​(List<AddPartition> addPartitions)
        Combines N add partition commands with M total partitions into ceil(M / MAX_ADDED_PARTITIONS) new add partition commands. If M > N * MAX_ADDED_PARTITIONS, then the result will be more than N elements. Each command except the last one will have MAX_ADDED_PARTITIONS partitions. Assumes that the commands are all for the same table, with no modifications to the table in between
        Parameters:
        addPartitions - the add partition commands to combine.
        Returns:
        the compacted add partition commands
      • isCompact

        public boolean isCompact()
        Mthod to determine whether a command was already compacted
        Returns:
        whether a command was compacted