You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by am...@apache.org on 2021/07/30 16:49:39 UTC

[sis] 03/07: fix(Feature): Workaround to prevent optimisation shorting

This is an automated email from the ASF dual-hosted git repository.

amanin pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git

commit ccb433e35bdfc45c7bccfd7aa927fba33b50319b
Author: Alexis Manin <al...@geomatys.com>
AuthorDate: Wed Jul 28 16:27:14 2021 +0200

    fix(Feature): Workaround to prevent optimisation shorting
    
    Some third-party implementation of filters use a different name for value reference expressions. Without support for it, the SQL filter conversion were stopped and the entire filter were delegated to java fallback. Such shorting cause a full scan of the dataset instead of delegating processing to database engine (that can use indices AND reduce IO amount by evaluating itself the filter).
---
 .../main/java/org/apache/sis/internal/sql/feature/ANSIInterpreter.java  | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/storage/sis-sqlstore/src/main/java/org/apache/sis/internal/sql/feature/ANSIInterpreter.java b/storage/sis-sqlstore/src/main/java/org/apache/sis/internal/sql/feature/ANSIInterpreter.java
index fc40e82..77a148d 100644
--- a/storage/sis-sqlstore/src/main/java/org/apache/sis/internal/sql/feature/ANSIInterpreter.java
+++ b/storage/sis-sqlstore/src/main/java/org/apache/sis/internal/sql/feature/ANSIInterpreter.java
@@ -145,6 +145,8 @@ class ANSIInterpreter extends Visitor<Feature,StringBuilder> {
         setExpressionHandler(FunctionNames.Multiply, new Join(" * "));
         setExpressionHandler(FunctionNames.Literal, (e,sb) -> writeLiteral(sb, (Literal<Feature,?>) e));
         setExpressionHandler(FunctionNames.ValueReference, (e,sb) -> writeColumnName(sb, (ValueReference<Feature,?>) e));
+        // Temporary workaround. Filters created from Filter Encoding XML can specify "PropertyName" instead of "Value reference".
+        setExpressionHandler("PropertyName", (e,sb) -> writeColumnName(sb, (ValueReference<Feature,?>) e));
     }
 
     /**