← eval operator page · general/eval/comp/inside_calc
pandas ✅ · DuckDB ✅
eval inside calc, after the page's DS_1 [calc Me := eval ( f (Me ) language "Java" returns integer) ]: the routine runs on the Me_1 of each data point.
Evaluation of an external routine: eval "returns its result as a Data Set or a scalar", of a type "given in the invocation". The page contradicts itself: "eval cannot be nested as the operand of another operation", its result "must be persistent", "This is not a scalar operation" and its "Result type" is result :: dataset, yet its own example nests it in calc, assigns it with := and gives an integer per data point; the example follows that example, with <-.
the error 1-3-2-5, "At op eval: Eval in component execution is not supported, it only applies to Data Sets": by a team decision, eval runs on data sets only, never inside a component expression.
DS_r <- DS_1[calc Me_2 := eval(SQL_4(Me_1) language "SQL" returns integer)];
| Id_1 | Me_1 |
|---|---|
| 1 | 10 |
| 2 | 20 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true}
]
}
]
}
{"code": "1-3-2-5"}
{
"name": "SQL_4",
"query": "SELECT $1 * 2"
}