modelop / hadrian

Implementations of the Portable Format for Analytics (PFA)
Apache License 2.0
130 stars 49 forks source link

[Hadrian] JSON datum "Inf" does not match type "double" #46

Open taunometsalu opened 6 years ago

taunometsalu commented 6 years ago

If I use "Inf" value in a cell, it works with Titus:

library(aurelius)
pfaDocument = pfa_document(
  input = avro_double,
  output = avro_boolean,
  cells = list(x = pfa_cell(avro_double, Inf)),
  action = expression(
    input < x
  )
)

library(jsonlite)
engine = pfa_engine(pfaDocument)
x = 1
engine$action(x)

But Hadrian gives error:

f = "/usr/local/src/gdrive/results/pfa/inf_example.pfa"
write_pfa(pfaDocument, file = f, pretty = TRUE)

library(jsonlite)
tmp1 = tempfile(fileext = ".json")
tmp2 = tempfile(fileext = ".json")
write(minify(toJSON(x, auto_unbox = TRUE)), file = tmp1)
cmd = paste0("cd /usr/local/src/gdrive/; touch ", tmp2, "; ",
             "java -jar scripts/hadrian/hadrian-standalone-0.8.1-jar-with-dependencies.jar -i json -o json ",
             f, " ", tmp1, " > ", tmp2)
system(cmd)

I expected that Titus and Hadrian should behave identically. Is it a bug of Titus or Hadrian?