Interface ModelParallelCalculationFormulaItemContext

All Superinterfaces:
ModelFormulaContextReadOnly

public interface ModelParallelCalculationFormulaItemContext extends ModelFormulaContextReadOnly
The ModelParallelCalculationFormulaItemContext is exposed to model parallel calculation logics through the model binding.
  • Method Details

    • calculationItem

      Returns:
      the item currently calculated
      Since:
      9.0 Hurricane
    • loadTable

      Sample code:
      
           def ctx = api.getDatamartContext()
           def query = ctx.newQuery(ctx.getDataSource("txDS"))
               .select("sku", "P")
               .select("SUM(amount)", "R")
               .where(Filter.equal("sku", model.calculationItem().inputs()['sku']))
           def table = model.getTable('MyTable')
           def nbRowAdded = model.loadTable(table, query)
       
      WARNING: the given query must be idempotent (e.g., using key columns on the table) as each item calculation may be run several times (by several nodes) and the ordering of their execution is also nondeterministic.
      Parameters:
      table - A table in this model
      query - An idempotent query to load into the table
      Returns:
      The number of row added
      Throws:
      InterruptedException
      Since:
      10.0 Bee's Knees
    • loadTable

      Sample code:
      
           def ctx = api.getDatamartContext()
           def t1 = ctx.newQuery(ctx.getDataSource("txDS"))
               .select("sku", "P")
               .select("SUM(amount)", "R")
               .where(Filter.equal("sku", model.calculationItem().inputs()['sku']))
           def query = ctx.newSqlQuery()
           query.addSource(t1)
           query.setQuery('SELECT P, R::numeric as R FROM T1 ORDER BY P')
           def table = model.getTable('MyTable')
           def nbRowAdded = model.loadTable(table, query)
       
      WARNING: the given query must be idempotent (e.g., using key columns on the table) as each item calculation may be run several times (by several nodes) and the ordering of their execution is also nondeterministic.
      Parameters:
      table - A table in this model
      query - An idempotent query to load into the table
      Returns:
      The number of row added
      Throws:
      InterruptedException
      Since:
      10.0 Bee's Knees