← length operator page · string/length/comp/manual_ex_3
pandas ✅ · DuckDB ✅
two length calls in one calc on DS_2, where Me_1 is null in one data point.
String length, Example 3, output verbatim: "Returns the length of a string."
Me_10 is 5 and null, and Me_20 is 5 and 2; Me_1 and Me_2 are kept. A null operand gives a null result: "most of the scalar operations (arithmetic, logical, and others) return null when any of their arguments is null" (User Manual).
DS_r := DS_2 [calc Me_10:= length(Me_1), Me_20:=length(Me_2)];
| Id_1 | Id_2 | Me_1 | Me_2 |
|---|---|---|---|
| 1 | A | hello | world |
| 2 | B | hi |
{
"datasets": [
{
"name": "DS_2",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Id_2", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "String", "role": "Measure", "nullable": true},
{"name": "Me_2", "type": "String", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Id_2 | Me_1 | Me_2 | Me_10 | Me_20 |
|---|---|---|---|---|---|
| 1 | A | hello | world | 5 | 5 |
| 2 | B | hi | 2 |
{
"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": "String", "role": "Measure"},
{"name": "Me_10", "type": "Integer", "role": "Measure"},
{"name": "Me_20", "type": "Integer", "role": "Measure"}
]
}
]
}