Class TreeTableOrphanPromoter

java.lang.Object
com.illumon.iris.db.v2.TreeTableOrphanPromoter
All Implemented Interfaces:
com.fishlib.base.Function.Unary<Table,​Table>

public class TreeTableOrphanPromoter
extends Object
implements com.fishlib.base.Function.Unary<Table,​Table>

Identify orphan rows in a table destined for conversion into a tree table, and mask their parent column value to null, so that they show up at the top level of the hierarchy.

This is useful if your data contains values which you can not identify as top-level rows; or if you would like to filter your tree table source, excluding parents which do not meet your filter criteria, but do not want to orphan the matches.

This class should be used by calling promoteOrphans(Table, String, String) method.

  • Method Details

    • call

      public Table call​(Table table)
      Specified by:
      call in interface com.fishlib.base.Function.Unary<Table,​Table>
    • promoteOrphans

      public static Table promoteOrphans​(Table table, String idColumn, String parentColumn)
      Convert a table with orphans to one without.
      Parameters:
      table - the input table to operate on
      idColumn - the column containing each row's unique ID
      parentColumn - the column containing the parent for this row; null for top-level rows
      Returns:
      a table where parentColumn is null if the original parent did not appear in the IDs