Re: [discuss] Add the default mode to the path in the Json functions.

2020-04-20 Thread Forward Xu
Hi Julian,
Thank you for bringing such a good shared link, there are some areas in the
JSON function that need to be improved and implemented. I will continue to
improve it.

Forward

Julian Hyde  于2020年4月21日周二 上午1:28写道:

> Speaking of JSON functions, JOOQ creator Lukas Eder has been giving JSON
> functions in MySQL/MariaDB a good workout over the last few days. It’s
> amusing to read what he has discovered: https://twitter.com/lukaseder <
> https://twitter.com/lukaseder>
>
> Julian
>
>
> > On Apr 20, 2020, at 8:27 AM, Stamatis Zampetakis 
> wrote:
> >
> > Hi,
> >
> > I know that Oracle uses lax by default [1] but I don't remember what
> other
> > DBMS do.
> >
> > In any case adopting a default mode sounds like a reasonable thing to do.
> >
> > Best,
> > Stamatis
> >
> > [1] https://docs.oracle.com/database/121/ADXDB/json.htm#ADXDB6259
> >
> >
> > On Mon, Apr 20, 2020, 7:28 AM Chunwei Lei 
> wrote:
> >
> >> Thank you for proposing this, Forward.
> >>
> >> I am wondering whether it is really useful for users who want to use
> these
> >> functions
> >> since they probably know what the syntax is. But personally I would
> like to
> >> have the
> >> default mode since it is more convenient.
> >>
> >>
> >> Best,
> >> Chunwei
> >>
> >>
> >> On Sun, Apr 19, 2020 at 9:51 AM Forward Xu 
> wrote:
> >>
> >>> hi everyone, I recently found some discussable optimizations when I
> >>> contributed the flip-90 [1] Json functions:
> >>> The current json functions in calcite: JSON_EXISTS, JSON_VALUE,
> >> JSON_QUERY,
> >>> JSON_OBJECT, JSON_OBJECTAGG, JSON_ARRAY, JSON_ARRAYAGG and IS JSON
> >>> predication functions. These functions are implemented based on the SQL
> >>> 2016-2017 standard [2]. According to this standard, the path of the
> json
> >>> function must be used in one of strict or lax mode. such as:
> >>> json_exists ('{"foo": "bar"}', 'lax $ .foo') or
> >>> json_exists ('{"foo": "bar"}', 'strict $ .foo')
> >>> Can we give a default mode to simplify the use of lax and strict. For
> >>> example, we default to lax mode. In this way, the use of our json
> >> function
> >>> can be simplified to:
> >>> json_exists ('{"foo": "bar"}', '$ .foo')
> >>> Implementation idea improvement JsonFunctions jsonApiCommonSyntax path
> >>> judgment to increase the default lax mode logic.
> >>> Of course, these changes are not described in SQL2016-2017.
> >>> I want to hear your opinion here.
> >>>
> >>> [1]
> >>>
> >>
> https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=141724550
> >>> [2]
> >>>
> >>>
> >>
> https://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
> >>>
> >>
>
>


Re: [discuss] Add the default mode to the path in the Json functions.

2020-04-20 Thread Julian Hyde
Speaking of JSON functions, JOOQ creator Lukas Eder has been giving JSON 
functions in MySQL/MariaDB a good workout over the last few days. It’s amusing 
to read what he has discovered: https://twitter.com/lukaseder 
 

Julian


> On Apr 20, 2020, at 8:27 AM, Stamatis Zampetakis  wrote:
> 
> Hi,
> 
> I know that Oracle uses lax by default [1] but I don't remember what other
> DBMS do.
> 
> In any case adopting a default mode sounds like a reasonable thing to do.
> 
> Best,
> Stamatis
> 
> [1] https://docs.oracle.com/database/121/ADXDB/json.htm#ADXDB6259
> 
> 
> On Mon, Apr 20, 2020, 7:28 AM Chunwei Lei  wrote:
> 
>> Thank you for proposing this, Forward.
>> 
>> I am wondering whether it is really useful for users who want to use these
>> functions
>> since they probably know what the syntax is. But personally I would like to
>> have the
>> default mode since it is more convenient.
>> 
>> 
>> Best,
>> Chunwei
>> 
>> 
>> On Sun, Apr 19, 2020 at 9:51 AM Forward Xu  wrote:
>> 
>>> hi everyone, I recently found some discussable optimizations when I
>>> contributed the flip-90 [1] Json functions:
>>> The current json functions in calcite: JSON_EXISTS, JSON_VALUE,
>> JSON_QUERY,
>>> JSON_OBJECT, JSON_OBJECTAGG, JSON_ARRAY, JSON_ARRAYAGG and IS JSON
>>> predication functions. These functions are implemented based on the SQL
>>> 2016-2017 standard [2]. According to this standard, the path of the json
>>> function must be used in one of strict or lax mode. such as:
>>> json_exists ('{"foo": "bar"}', 'lax $ .foo') or
>>> json_exists ('{"foo": "bar"}', 'strict $ .foo')
>>> Can we give a default mode to simplify the use of lax and strict. For
>>> example, we default to lax mode. In this way, the use of our json
>> function
>>> can be simplified to:
>>> json_exists ('{"foo": "bar"}', '$ .foo')
>>> Implementation idea improvement JsonFunctions jsonApiCommonSyntax path
>>> judgment to increase the default lax mode logic.
>>> Of course, these changes are not described in SQL2016-2017.
>>> I want to hear your opinion here.
>>> 
>>> [1]
>>> 
>> https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=141724550
>>> [2]
>>> 
>>> 
>> https://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
>>> 
>> 



Re: [discuss] Add the default mode to the path in the Json functions.

2020-04-20 Thread Stamatis Zampetakis
Hi,

I know that Oracle uses lax by default [1] but I don't remember what other
DBMS do.

In any case adopting a default mode sounds like a reasonable thing to do.

Best,
Stamatis

[1] https://docs.oracle.com/database/121/ADXDB/json.htm#ADXDB6259


On Mon, Apr 20, 2020, 7:28 AM Chunwei Lei  wrote:

> Thank you for proposing this, Forward.
>
>  I am wondering whether it is really useful for users who want to use these
> functions
> since they probably know what the syntax is. But personally I would like to
> have the
> default mode since it is more convenient.
>
>
> Best,
> Chunwei
>
>
> On Sun, Apr 19, 2020 at 9:51 AM Forward Xu  wrote:
>
> > hi everyone, I recently found some discussable optimizations when I
> > contributed the flip-90 [1] Json functions:
> > The current json functions in calcite: JSON_EXISTS, JSON_VALUE,
> JSON_QUERY,
> > JSON_OBJECT, JSON_OBJECTAGG, JSON_ARRAY, JSON_ARRAYAGG and IS JSON
> > predication functions. These functions are implemented based on the SQL
> > 2016-2017 standard [2]. According to this standard, the path of the json
> > function must be used in one of strict or lax mode. such as:
> > json_exists ('{"foo": "bar"}', 'lax $ .foo') or
> > json_exists ('{"foo": "bar"}', 'strict $ .foo')
> > Can we give a default mode to simplify the use of lax and strict. For
> > example, we default to lax mode. In this way, the use of our json
> function
> > can be simplified to:
> > json_exists ('{"foo": "bar"}', '$ .foo')
> > Implementation idea improvement JsonFunctions jsonApiCommonSyntax path
> > judgment to increase the default lax mode logic.
> > Of course, these changes are not described in SQL2016-2017.
> > I want to hear your opinion here.
> >
> > [1]
> >
> https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=141724550
> > [2]
> >
> >
> https://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
> >
>


Re: [discuss] Add the default mode to the path in the Json functions.

2020-04-19 Thread Chunwei Lei
Thank you for proposing this, Forward.

 I am wondering whether it is really useful for users who want to use these
functions
since they probably know what the syntax is. But personally I would like to
have the
default mode since it is more convenient.


Best,
Chunwei


On Sun, Apr 19, 2020 at 9:51 AM Forward Xu  wrote:

> hi everyone, I recently found some discussable optimizations when I
> contributed the flip-90 [1] Json functions:
> The current json functions in calcite: JSON_EXISTS, JSON_VALUE, JSON_QUERY,
> JSON_OBJECT, JSON_OBJECTAGG, JSON_ARRAY, JSON_ARRAYAGG and IS JSON
> predication functions. These functions are implemented based on the SQL
> 2016-2017 standard [2]. According to this standard, the path of the json
> function must be used in one of strict or lax mode. such as:
> json_exists ('{"foo": "bar"}', 'lax $ .foo') or
> json_exists ('{"foo": "bar"}', 'strict $ .foo')
> Can we give a default mode to simplify the use of lax and strict. For
> example, we default to lax mode. In this way, the use of our json function
> can be simplified to:
> json_exists ('{"foo": "bar"}', '$ .foo')
> Implementation idea improvement JsonFunctions jsonApiCommonSyntax path
> judgment to increase the default lax mode logic.
> Of course, these changes are not described in SQL2016-2017.
> I want to hear your opinion here.
>
> [1]
> https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=141724550
> [2]
>
> https://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip
>


[discuss] Add the default mode to the path in the Json functions.

2020-04-18 Thread Forward Xu
hi everyone, I recently found some discussable optimizations when I
contributed the flip-90 [1] Json functions:
The current json functions in calcite: JSON_EXISTS, JSON_VALUE, JSON_QUERY,
JSON_OBJECT, JSON_OBJECTAGG, JSON_ARRAY, JSON_ARRAYAGG and IS JSON
predication functions. These functions are implemented based on the SQL
2016-2017 standard [2]. According to this standard, the path of the json
function must be used in one of strict or lax mode. such as:
json_exists ('{"foo": "bar"}', 'lax $ .foo') or
json_exists ('{"foo": "bar"}', 'strict $ .foo')
Can we give a default mode to simplify the use of lax and strict. For
example, we default to lax mode. In this way, the use of our json function
can be simplified to:
json_exists ('{"foo": "bar"}', '$ .foo')
Implementation idea improvement JsonFunctions jsonApiCommonSyntax path
judgment to increase the default lax mode logic.
Of course, these changes are not described in SQL2016-2017.
I want to hear your opinion here.

[1]
https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=141724550
[2]
https://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip