Hi Julian, thanks for your answer. I was thinking on a method. I will tell you if I make progress in this line, first I have to get familiar with the Calcite API.
Thanks again for your help. Greetings, Juan On Thu, Jun 2, 2016 at 1:17 PM, Julian Hyde <[email protected]> wrote: > Would this be just a method, or would this be a user-defined function > that can be called from SQL? > > Writing it as a method would be straightforward, although it would > have to make certain assumptions about the mapping between JSON types > and SQL types. Writing it as a UDF is a bit harder, because we don't > have a way of representing types as values in SQL. > > One way to package it, that I think would be useful to other people, > would be a method in RexBuilder: > > RexLiteral makeLiteralFromJson( > Object o, > RelDataType type, > boolean ignoreUnknownFields) > > The input object, o, would be made up of Number, String, Boolean, > List, Map in the usual way, and would throw if the object does not > match the given type. > > Julian > > > > On Thu, Jun 2, 2016 at 12:39 PM, Juan Rodríguez Hortalá > <[email protected]> wrote: > > Hi, > > > > I have to check that some JSON objects have a certain shape. The idea is > > defining a method that given a RelDataType and a String for a JSON > object, > > returns a boolean saying whether the JSON is complaint with the schema or > > not. Can that be easily implemented with Calcite? > > > > Thanks in advance. > > > > Greetings, > > > > Juan >
