Interface Hierarchy

All Superinterfaces:
CqnHierarchy, CqnSource, CqnTableFunction, CqnToken, JSONizable, Source<StructuredType<?>>, TableFunction

@Beta public interface Hierarchy extends CqnHierarchy, TableFunction
A SAP HANA hierarchy generator function that generates a hierarchy based on recursive parent-child source data. The function adds the following elements to the result:
Added elements
element nametypedescription
hierarchy_rankInt64The preorder rank of the node in the tree representation of the result set
hierarchy_levelInt32The level to which the node belongs
hierarchy_tree_sizeInt64The number of descendant nodes +1
  • Method Details

    • copy

      Hierarchy copy(Source<?> source)
      Creates a copy of this hierarchy generator function with the given source.
      Specified by:
      copy in interface TableFunction
      Parameters:
      source - the hierarchy source
      Returns:
      new hierarchy generator function with the given source
    • startWhere

      Hierarchy startWhere(CqnPredicate startWhere)
      Specifies a filter condition that identifies the root nodes of the hierarchy generated by this generator. If no filter is specified the root nodes are identified by the condition `parent_id = NULL`.
      Parameters:
      startWhere - the filter condition
      Returns:
      this hierarchy generator function
    • orderBy

      Hierarchy orderBy(CqnSortSpecification... siblingOrderBy)
      Specifies the sort order of sibling nodes. This overrides any sort order the source might originally have.
      Parameters:
      siblingOrderBy - the sort specifications
      Returns:
      this hierarchy generator function
    • orderBy

      Hierarchy orderBy(List<CqnSortSpecification> siblingOrderBy)
      Specifies the sort order of sibling nodes. This overrides any sort order the source might originally have.
      Parameters:
      siblingOrderBy - the sort specifications
      Returns:
      this hierarchy generator function
    • orderBy

      Hierarchy orderBy(String... siblingOrderBy)
      Specifies the sort order of sibling nodes given as element names of the source of this hierarchy. This overrides any sort order the source might originally have.
      Parameters:
      siblingOrderBy - the element names
      Returns:
      this hierarchy generator function
    • depth

      Hierarchy depth(Integer depth)
      Specifies the maximum search depth during hierarchy generation.
      Parameters:
      depth - the maximum depth
      Returns:
      this hierarchy generator function