There is "Expression/NIL".

But it is not a literal, it's a property :/ A pseudo-property I'd say. See org.geotools.filter.expression.NullPropertyAccessorFactory

It definitely has uses, it's used in both app-schema and CSW mappings.

A literal would be more appropriate.

Regards

Niels

On 15/05/2020 04:15, Jody Garnett 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
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to