UBOdin / mimir

Data-ish exploration through SQL+Uncertainty
http://mimirdb.info
Apache License 2.0
27 stars 13 forks source link

JSON Encoding for operator trees #215

Closed okennedy closed 7 years ago

okennedy commented 7 years ago

It would be convenient to have a more standardized scheme for encoding/decoding operator trees, ideally one that's vaguely human readable (e.g., JSON or YAML). We tried this with mimir.parsers, but Scala ParserCombinators are crap... and not really more human-readable than we need. A more rigid structure like JSON should be a happy medium, and might eventually admit the use of something like ValkyrieDB

So then, for example to generate the following Scala expression:

  Project(
    Seq(ProjectArg("A", Var("B"))), 
    Table("R", Seq(("A", TInt()), ("B", TFloat()), Seq())
  )

We'd have:

{ 
  "type" : "project", 
  "args" : [
    { "alias" : "A", "expression" : { "type" : "column", "name" : "B" } }
  ],
  "source" : {
    "type" : "table",
    "name" : "R",
    "schema" : [
      { "name" : "A", "type" : "int" },
      { "name" : "B", "type" : "float" }
    ]
  }
}

The key place this would get used is in mimir.views.ViewManager

okennedy commented 7 years ago

Fixed in #229

mrb24 commented 7 years ago

JSON Serialization of operator trees: merged into master by commit: 5a3d0eb48f0d8eceae17adc3c7ff9041d4a5dba3