← cross_join operator page · join/cross_join/nary/three_operands

Three operands 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

a cross join of three operands with no common component.

Manual:

Cross Join: "In each step, a data point in VDS₁ is generated for each pair of data points in the partial result and the joined data set", and "the step is repeated by joining this partial result to the next data set".

Expected:

DS_3 has Id_3 P and Q: 2 × 2 × 2 = 8 data points, with Id_1, Id_2, Id_3 and the three measures.

script.vtl ⇩

DS_r := cross_join(DS_1, DS_2, DS_3);

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}
      ]
    }
  ]
}

input/DS_3.csv ⇩

Id_3Me_3
P100
Q200

input/DS_3.json ⇩

{
  "datasets": [
    {
      "name": "DS_3",
      "DataStructure": [
        {"name": "Id_3", "type": "String", "role": "Identifier", "nullable": false},
        {"name": "Me_3", "type": "Number", "role": "Measure", "nullable": true}
      ]
    }
  ]
}

expected/DS_r.csv ⇩

Id_1Id_2Id_3Me_1Me_2Me_3
1AP101100
1AQ101200
1BP102100
1BQ102200
2AP201100
2AQ201200
2BP202100
2BQ202200

expected/DS_r.json ⇩

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