A couple of minor things. Your isJson function should return boolean not 
Boolean, because the ISJSON function is strict - i.e. returns unknown if and 
only if its input is null. If the input is null the code generator will not 
call it.

I think SqlIsJsonFunction is probably not necessary. I think everything about 
the function can be deduced by reflection. (That’s how the Geo functions work, 
also.)

I’d add tests for JSON functions to SqlOperatorBaseTest rather than creating 
CalciteJsonOperatorTest and JsonOperatorBaseTest. JSON functions are not that 
different from the built-in function set. (The Geo functions are not in the SQL 
standard; that’s why I separated them a bit.)

Julian


> On Apr 18, 2018, at 5:59 PM, Michael Mior <[email protected]> wrote:
> 
> Thanks Julian! I opened CALCITE-2266 to track implementing some of the new
> JSON functions. I took a stab at implementing ISJSON in the following
> commit:
> 
> https://github.com/michaelmior/calcite/commit/d6930fcd04ed83d37f56a7795ee794
> 1b521fb99c
> 
> These are touching parts of the code base I'm unfamiliar with so I mostly
> don't know what I'm doing :) I added a new operator table which I'm
> guessing we probably don't want to do but it made it easier for me when
> testing to isolate the new code.
> 
> --
> Michael Mior
> [email protected]
> 
> 2018-04-18 17:00 GMT-04:00 Julian Hyde <[email protected]>:
> 
>> Somehow I missed it, but a new version of the SQL standard was released in
>> December 2016. Here is wikipedia’s description of the new features:
>> 
>>> SQL:2016 introduced 44 new optional features. 22 of them belong
>>> to the JSON functionality, ten more are related to polymorphic table
>>> functions. The additions to the standard include:
>>> 
>>> * JSON: Functions to create JSON documents, to access parts of
>>>   JSON documents and to check whether a string contains valid
>>>  JSON data
>>> * Row Pattern Recognition: Matching a sequence of rows against
>>>  a regular expression pattern
>>> * Date and time formatting and parsing
>>> * LISTAGG: A function to transform values from a group of rows into a
>>>  delimited string
>>> * Polymorphic table functions: table functions without predefined return
>> type
>>> * New data type DECFLOAT
>> 
>> Nothing earth-shattering, but some good stuff there. DECFLOAT makes a lot
>> of sense — businesses hate the kind of rounding errors that binary floating
>> point introduces, and DECFLOAT would seem to map directly to java’s
>> BigDecimal.
>> 
>> And MATCH_RECOGNIZE, which we have already started work on.
>> 
>> Julian
>> 
>> 

Reply via email to