In-Data Programming is a mechanism provided by BigObject to realize the idea of "computations take place where data resides". Currently it supports Lua programming language. This tutorial provides some guidelines on how to program on tree objects and table objects.
In general, user-defined functions are invoked in the FIND, APPLY or SELECT statements to handle data in a record or node-based manner. A general purpose function to perform a series of operations in object level can be invoked by APPLY statement. For example,
APPLY run_total("sales", "qty", "qty_rt")
will invoke function
run_total() to open table sales, calculate the
running total for column qty, and store the results in column qty_rt.
run_total() is listed below:
function run_total(bt, col, rt_col) t = bo.getTable(bt) rt = t:getColumnValue(col); for i = 2, #rt do rt[i] = rt[i] + rt[i-1] end t:setColumnValue(rt_col, rt) end
Note: Please refer to import LUA Function on how to upload your functions/scripts into BigObject Analytics.