Class DataFrameContext

java.lang.Object
org.rumbledb.runtime.flwor.udfs.DataFrameContext
All Implemented Interfaces:
Serializable

public class DataFrameContext extends Object implements Serializable
This class exposes a reusable context that is dynamically populated from the input tuples stored in DataFrames. It also pools Kryo objects, inputs and outputs for better performance. This class is meant to be used by various FLWOR clauses to get a context in which to evaluate their expressions.
Author:
Ghislain Fourny
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Builds a new data frame context that only serves to pool Kryo objects.
    Builds a new data frame context.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the currently populated dynamic context.
    com.esotericsoftware.kryo.io.Input
    Gets a Kryo input that the caller can use for deserialization purposes.
    com.esotericsoftware.kryo.Kryo
    Gets a Kryo object that the caller can use for serialization and deserialization purposes.
    com.esotericsoftware.kryo.io.Output
    Gets a Kryo output that the caller can use for serialization purposes.
    void
    setFromRow(org.apache.spark.sql.Row row)
    Sets the context from a DataFrame row.
    void
    setFromRow(org.apache.spark.sql.Row row, ItemType itemType)
    Sets the context from a DataFrame row.

    Methods inherited from class java.lang.Object

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

    • DataFrameContext

      public DataFrameContext()
      Builds a new data frame context that only serves to pool Kryo objects. The only allowed methods are getKryo, getInput and getOutput.
    • DataFrameContext

      public DataFrameContext(DynamicContext context, List<FlworDataFrameColumn> columns)
      Builds a new data frame context.
      Parameters:
      context - the parent dynamic context, which contains all variable values except those in input tuples.
      columns - the DataFrame columns applicable to the calling clause.
  • Method Details

    • setFromRow

      public void setFromRow(org.apache.spark.sql.Row row)
      Sets the context from a DataFrame row.
      Parameters:
      row - An row, the column names and types of which must correspond to those passed in the constructor.
    • setFromRow

      public void setFromRow(org.apache.spark.sql.Row row, ItemType itemType)
      Sets the context from a DataFrame row.
      Parameters:
      row - An row, the column names and types of which must correspond to those passed in the constructor.
      itemType - the itemType to use for the conversion.
    • getContext

      public DynamicContext getContext()
      Gets the currently populated dynamic context. It is a child of the context passed to the constructor, populated with the current input tuple with one of the two set* functions.
      Returns:
      the dynamic context, for evaluating and expression.
    • getOutput

      public com.esotericsoftware.kryo.io.Output getOutput()
      Gets a Kryo output that the caller can use for serialization purposes.
      Returns:
      a Kryo output.
    • getKryo

      public com.esotericsoftware.kryo.Kryo getKryo()
      Gets a Kryo object that the caller can use for serialization and deserialization purposes.
      Returns:
      a Kryo.
    • getInput

      public com.esotericsoftware.kryo.io.Input getInput()
      Gets a Kryo input that the caller can use for deserialization purposes.
      Returns:
      a Kryo input.