← calc operator page · clause/calc/identifier/new_identifier_from_measure
pandas ✅ · DuckDB ✅
calc identifier Id_2 := Me_1: a new identifier with the values of the String measure Me_1, which DS_1 declares non-nullable.
Calculation of a Component: "The operator calculates new Identifier, Measure or Attribute Components on the basis of sub-expressions at Component level", and "If the calculated Component is a new Component, it is added to the output Data Set".
Id_2 is added next to Id_1, with A and B; Me_1 and Me_2 are unchanged. By the team decision of #1010, calc identifier raises SemanticError 1-1-1-16 over an expression declared nullable, whatever the data (intended), and 2-1-1-16 when a null reaches a non-nullable one at run time: Me_1 is declared non-nullable, the form that the manual and the decision both accept, and the decision does not change this output.
DS_r := DS_1 [ calc identifier Id_2 := Me_1 ];
| Id_1 | Me_1 | Me_2 |
|---|---|---|
| 1 | A | 10 |
| 2 | B | 20 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "String", "role": "Measure", "nullable": false},
{"name": "Me_2", "type": "Integer", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Id_2 | Me_1 | Me_2 |
|---|---|---|---|
| 1 | A | A | 10 |
| 2 | B | B | 20 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Id_2", "type": "String", "role": "Identifier"},
{"name": "Me_1", "type": "String", "role": "Measure"},
{"name": "Me_2", "type": "Integer", "role": "Measure"}
]
}
]
}