← cross_join operator page · join/cross_join/keep/keep_one_measure

Keep one measure 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

keep Me_1.

Manual:

Cross Join: "keep will maintain all the identifiers and only the specified non-identifier components of VDS₃".

Expected:

the cartesian product of DS_1 (Id_1 1, 2) and DS_2 (Id_2 A, B) has 2 × 2 = 4 data points, with Me_1 only: 10, 10, 20 and 20.

script.vtl ⇩

DS_r := cross_join(DS_1, DS_2 keep Me_1);

input/DS_1.csv ⇩

Id_1Me_1
110
220

input/DS_1.json ⇩

{
  "datasets": [
    {
      "name": "DS_1",
      "DataStructure": [
        {"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
        {"name": "Me_1", "type": "Number", "role": "Measure", "nullable": true}
      ]
    }
  ]
}

input/DS_2.csv ⇩

Id_2Me_2
A1
B2

input/DS_2.json ⇩

{
  "datasets": [
    {
      "name": "DS_2",
      "DataStructure": [
        {"name": "Id_2", "type": "String", "role": "Identifier", "nullable": false},
        {"name": "Me_2", "type": "Number", "role": "Measure", "nullable": true}
      ]
    }
  ]
}

expected/DS_r.csv ⇩

Id_1Id_2Me_1
1A10
1B10
2A20
2B20

expected/DS_r.json ⇩

{
  "datasets": [
    {
      "name": "DS_r",
      "DataStructure": [
        {"name": "Id_1", "type": "Integer", "role": "Identifier"},
        {"name": "Id_2", "type": "String", "role": "Identifier"},
        {"name": "Me_1", "type": "Number", "role": "Measure"}
      ]
    }
  ]
}