← unpivot operator page · clause/unpivot/basic/null_measure_skipped
pandas ✅ · DuckDB ✅
unpivot Id_2, Me_3, on a data point whose Me_2 is null.
Unpivoting: "For each Data Point DP and for each Measure M of op whose value is not null, the operator inserts a Data Point into VDS", and "When a Measure is null then unpivot does not create a Data Point for that Measure."
(1, Me_1) = 5, (2, Me_1) = 3 and (2, Me_2) = 4, with no data point for the null Me_2 of Id_1 = 1. Id_2 holds component names, so it is a String, and Me_3 has the type of the measures, Integer.
DS_r := DS_1 [ unpivot Id_2, Me_3 ];
| Id_1 | Me_1 | Me_2 |
|---|---|---|
| 1 | 5 | |
| 2 | 3 | 4 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true},
{"name": "Me_2", "type": "Integer", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Id_2 | Me_3 |
|---|---|---|
| 1 | Me_1 | 5 |
| 2 | Me_1 | 3 |
| 2 | Me_2 | 4 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Id_2", "type": "String", "role": "Identifier"},
{"name": "Me_3", "type": "Integer", "role": "Measure"}
]
}
]
}