Class FragmentLeaf

java.lang.Object
io.trino.operator.table.json.execution.FragmentLeaf
All Implemented Interfaces:
JsonTableProcessingFragment

public class FragmentLeaf extends Object implements JsonTableProcessingFragment
  • Constructor Summary

    Constructors
    Constructor
    Description
    FragmentLeaf(IrJsonPath path, List<Column> columns, boolean errorOnError, Object[] newRow, ConnectorSession session, Metadata metadata, TypeManager typeManager, FunctionManager functionManager)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int[]
    Returns an array containing indexes of columns produced by the fragment within all columns produced by json_table.
    boolean
    Tries to produce output values for all columns included in the Fragment, and stores them in corresponding positions in `newRow`.
    void
    reset(com.fasterxml.jackson.databind.JsonNode item, Page input, int position)
    Prepares the Fragment to produce rows for the new JSON item.
    void
    resetRoot(com.fasterxml.jackson.databind.JsonNode item, Page input, int position, Object[] pathParameters)
    FragmentLeaf can be the root Fragment.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • reset

      public void reset(com.fasterxml.jackson.databind.JsonNode item, Page input, int position)
      Description copied from interface: JsonTableProcessingFragment
      Prepares the Fragment to produce rows for the new JSON item. Note: This method must be called for each new JSON item. Due to nesting, there might be multiple JSON items to process for a single position in the input page. Therefore, input and position may not change for subsequent calls.
      Specified by:
      reset in interface JsonTableProcessingFragment
      Parameters:
      item - the new JSON item
      input - the input Page currently processed by json_table function
      position - the currently processed position in the input page
    • resetRoot

      public void resetRoot(com.fasterxml.jackson.databind.JsonNode item, Page input, int position, Object[] pathParameters)
      FragmentLeaf can be the root Fragment. The root fragment is the only fragment that may have path parameters. Prepares the root Fragment to produce rows for the new JSON item and a set of path parameters.
      Specified by:
      resetRoot in interface JsonTableProcessingFragment
      Parameters:
      item - the new JSON item
      input - the input Page currently processed by json_table function
      position - the currently processed position in the input page
      pathParameters - JSON path parameters for the top-level JSON path
    • getRow

      public boolean getRow()
      Description copied from interface: JsonTableProcessingFragment
      Tries to produce output values for all columns included in the Fragment, and stores them in corresponding positions in `newRow`. Note: According to OUTER or UNION semantics, some values might be null-padded instead of computed. Note: a single JSON item might result in multiple output rows. To fully process a JSON item, the caller must: - reset the Fragment with the JSON item - call getRow() and collect output rows as long as `true` is returned If `false` is returned, there is no output row available, and the JSON item is fully processed
      Specified by:
      getRow in interface JsonTableProcessingFragment
      Returns:
      true if row was produced, false if row was not produced (Fragment is finished)
    • getOutputLayout

      public int[] getOutputLayout()
      Description copied from interface: JsonTableProcessingFragment
      Returns an array containing indexes of columns produced by the fragment within all columns produced by json_table.
      Specified by:
      getOutputLayout in interface JsonTableProcessingFragment