vmware-archive / database-stream-processor

Streaming and Incremental Computation Framework
Other
225 stars 20 forks source link

[JIT] What is the JSON representation for a map_index operator? #370

Closed mihaibudiu closed 1 year ago

mihaibudiu commented 1 year ago

A small JSON example would be great. I couldn't find one in my records, sorry if you sent one already.

Kixiron commented 1 year ago

The map operator is polymorphic and can take either a set or a map as inputs and produce either a set or a map which should allow it to perform both the job of map and of map_index. I thought I had already pushed this but apparently not, so the changes are waiting for #376 to merge. The json should look like this and will vary based off of the input and output stream types, set->set, set->map, map->set and map->map (the example json is for map->set as you can see through the input_layout and output_layout fields, this also affects the map_fn's args)

"Map": {
  "input": 3,
  "map_fn": {
    "args": [
      {
        "id": 1,
        "layout": 1,
        "flags": "input"
      },
      {
        "id": 2,
        "layout": 4,
        "flags": "input"
      },
      {
        "id": 3,
        "layout": 4,
        "flags": "output"
      }
    ],
    "ret": "Unit",
    "entry_block": 1,
    "blocks": {
      "bb1": {
        "id": 1,
        "params": [],
        "body": [
          [
            4,
            {
              "Load": {
                "source": 2,
                "source_layout": 4,
                "column": 0,
                "column_type": "U32"
              }
            }
          ],
          [
            5,
            {
              "BinOp": {
                "lhs": 4,
                "rhs": 4,
                "operand_ty": "U32",
                "kind": "Mul"
              }
            }
          ],
          [
            6,
            {
              "Store": {
                "target": 3,
                "target_layout": 4,
                "column": 0,
                "value": {
                  "Expr": 5
                },
                "value_type": "U32"
              }
            }
          ]
        ],
        "terminator": {
          "Return": {
            "value": {
              "Imm": "Unit"
            }
          }
        }
      }
    }
  },
  "input_layout": {
    "Map": [
      1,
      4
    ]
  },
  "output_layout": {
    "Set": 4
  }
}