I wanted to test the handling of the mbstyle coalesce function (see pr
<https://github.com/geotools/geotools/pull/2930>):
filter:* ['coalesce', 'aString', null, 5]*
And expected ECQL output similar to:
filter:* coalesce('aString',NULL,5) = true*
I was surprised to get a stack trace.
--
Jody Garnett
On Fri, 15 May 2020 at 00:34, Andrea Aime <[email protected]>
wrote:
> Hi Jody,
> null is not particularly useful in most expressions, as a consequence I'm
> not surprised there is not a NULL literal.
> However, just like in SQL, there is a "IS NULL" operator. From our
> examples
> <https://docs.geotools.org/latest/userguide/library/cql/ecql.html>:
>
> Filter filter = ECQL.toFilter(" Name IS NULL");
>
>
> What other "null" needs do you have?
>
> Cheers
> Andrea
>
> On Fri, May 15, 2020 at 4:17 AM Jody Garnett <[email protected]>
> wrote:
>
>> I have been updating mbstyle filter to support expressions, and ran into
>> something odd when writing tests (using ECQL to compare the output). It
>> appears that a literal null value does not have a representation in ECQL.
>> Indeed right now this causes a nice stacktrace to ECQL.toECQL( filter ).
>>
>> I am not sure how we made it this far without one? Options:
>>
>> - '' - empty string is not quite NULL but close
>> - NULL - already a reserved word, may actually be correct?
>>
>> At a minimum I would like to throw a kinder error message -
>> ExpressionToText:
>>
>> public Object visit(Literal expression, Object extraData) {
>> ...
>> } else {
>> if (literal == null) {
>> throw new NullPointerException("ECQL does not support
>> null literal value");
>> } else {
>> String escaped = literal.toString().replaceAll("'", "''");
>> output.append("'" + escaped + "'");
>> }
>> }
>> return output;
>> }
>>
>> Searching online is difficult as the presence of "IS NULL" and "IS NOT
>> NULL".
>> --
>> Jody Garnett
>> _______________________________________________
>> GeoTools-Devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/geotools-devel
>>
>
>
> --
>
> Regards, Andrea Aime
>
> == GeoServer Professional Services from the experts! Visit
> http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf
> Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa
> (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549
> http://www.geo-solutions.it http://twitter.com/geosolutions_it
> ------------------------------------------------------- *Con riferimento
> alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 -
> Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni
> circostanza inerente alla presente email (il suo contenuto, gli eventuali
> allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i
> destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per
> errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le
> sarei comunque grato se potesse darmene notizia. This email is intended
> only for the person or entity to which it is addressed and may contain
> information that is privileged, confidential or otherwise protected from
> disclosure. We remind that - as provided by European Regulation 2016/679
> “GDPR” - copying, dissemination or use of this e-mail or the information
> herein by anyone other than the intended recipient is prohibited. If you
> have received this email by mistake, please notify us immediately by
> telephone or e-mail.*
>
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel