Class NonEmptyTableChooser

java.lang.Object
com.illumon.iris.db.v2.NonEmptyTableChooser

public class NonEmptyTableChooser
extends Object
If we have a set of tables, we would like to pick the highest priority table that is non-empty. Once a table has been chosen, we will never choose a lower priority table, even if the higher priority table then becomes empty. The tables are passed in order of highest priority to lowest priority. For example: Table result = NonEmptyTableChooser.chooseFirstNonEmptyTable(todaysData, eodData, fallbackData); If eodData is ever non-empty, then fallbackData is no longer used even if eodData becomes empty. If todaysData becomes non-empty, then eodData and fallbackData will not be used.
  • Method Details

    • chooseFirstNonEmptyTable

      public static Table chooseFirstNonEmptyTable​(Table... inputs)
      Return a table that reflects the first non-empty Table in inputs. Once a table becomes non-empty, a subsequent table will never be chosen again.
      Parameters:
      inputs - the tables to process
      Returns:
      a table that is the first input that was ever non-empty
    • chooseFirstNonEmptyTable

      public static Table chooseFirstNonEmptyTable​(com.fishlib.io.logger.Logger log, Table... inputs)
      Return a table that reflects the first non-empty Table in inputs. Once a table becomes non-empty, a subsequent table will never be chosen again.
      Parameters:
      log - the log for our MergedListener
      inputs - the tables to process
      Returns:
      a table that is the first input that was ever non-empty