← parentheses operator page · general/parentheses/comp/precedence_in_calc
pandas ✅ · DuckDB ✅
Parentheses on components inside calc: (Me_1 + 2) * 3 adds before it multiplies.
Parentheses: "The operations enclosed in the parentheses are evaluated first", with ( CMP_1 - CMP_2 ) among the valid syntaxes and op of type dataset | component | scalar.
Me_2 is (1 + 2) * 3 = 9 and (4 + 2) * 3 = 18, Integers; without the parentheses the multiplication would come first and give 7 and 10.
DS_r := DS_1[calc Me_2 := (Me_1 + 2) * 3];
| Id_1 | Me_1 |
|---|---|
| 1 | 1 |
| 2 | 4 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Me_1 | Me_2 |
|---|---|---|
| 1 | 1 | 9 |
| 2 | 4 | 18 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Me_1", "type": "Integer", "role": "Measure"},
{"name": "Me_2", "type": "Integer", "role": "Measure"}
]
}
]
}