sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ama...@apache.org
Subject [sis] 17/22: fix(SQLStore): throw proper exception on an unsupported filter.
Date Thu, 14 Nov 2019 11:46:51 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit b4d906c446a33fb558bff28cbbd4013348484d07
Author: Alexis Manin <amanin@apache.org>
AuthorDate: Tue Nov 12 17:29:14 2019 +0100

    fix(SQLStore): throw proper exception on an unsupported filter.
---
 .../sis/internal/sql/feature/ANSIInterpreter.java  |  8 ++++--
 .../apache/sis/internal/sql/feature/Import.java    | 33 ----------------------
 .../internal/sql/feature/PostGISInterpreter.java   |  2 ++
 3 files changed, 7 insertions(+), 36 deletions(-)

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 76bfec0..aef825e 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
@@ -54,8 +54,8 @@ import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
  *
  * No case insensitive support of binary comparison is done.
  *
- * TODO: define a set of accepter property names, so any {@link PropertyName} filter refering
to non pure SQL property
- * (like relations) will cause a failure.
+ * TODO: define a set of accepter property names (even better: link to {@link FeatureAdapter}),
so any {@link PropertyName}
+ * filter refering to non pure SQL property (like relations) will cause a failure.
  *
  * @author Alexis Manin (Geomatys)
  */
@@ -184,6 +184,8 @@ public class ANSIInterpreter implements FilterVisitor, ExpressionVisitor
{
     public Object visit(BBOX filter, Object extraData) {
         // TODO: This is a wrong interpretation, but sqlmm has no equivalent of filter encoding
bbox, so we'll
         // fallback on a standard intersection. However, PostGIS, H2, etc. have their own
versions of such filters.
+        if (filter.getExpression1() == null || filter.getExpression2() == null)
+            throw new UnsupportedOperationException("Not supported yet : bbox over all geometric
properties");
         return function("ST_Intersects", filter, extraData);
     }
 
@@ -212,7 +214,7 @@ public class ANSIInterpreter implements FilterVisitor, ExpressionVisitor
{
 
     @Override
     public Object visit(DWithin filter, Object extraData) {
-        // TODO: as for beyond, unit determination is a bit complicated.
+        // TODO: as for beyond filter above, unit determination is a bit complicated.
         throw new UnsupportedOperationException("Not yet: unit management to handle properly");
     }
 
diff --git a/storage/sis-sqlstore/src/main/java/org/apache/sis/internal/sql/feature/Import.java
b/storage/sis-sqlstore/src/main/java/org/apache/sis/internal/sql/feature/Import.java
deleted file mode 100644
index f5614e1..0000000
--- a/storage/sis-sqlstore/src/main/java/org/apache/sis/internal/sql/feature/Import.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.apache.sis.internal.sql.feature;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-class Import {
-
-    final String propertyName;
-
-    final List<String> fkColumns;
-
-    final TableReference target;
-
-    public Import(String propertyName, Collection<String> fkColumns, TableReference
target) {
-        this.propertyName = propertyName;
-        this.fkColumns = Collections.unmodifiableList(new ArrayList<>(fkColumns));
-        this.target = target;
-    }
-
-    public String getPropertyName() {
-        return propertyName;
-    }
-
-    public List<String> getFkColumns() {
-        return fkColumns;
-    }
-
-    public TableReference getTarget() {
-        return target;
-    }
-}
diff --git a/storage/sis-sqlstore/src/main/java/org/apache/sis/internal/sql/feature/PostGISInterpreter.java
b/storage/sis-sqlstore/src/main/java/org/apache/sis/internal/sql/feature/PostGISInterpreter.java
index 684c1d8..1c78254 100644
--- a/storage/sis-sqlstore/src/main/java/org/apache/sis/internal/sql/feature/PostGISInterpreter.java
+++ b/storage/sis-sqlstore/src/main/java/org/apache/sis/internal/sql/feature/PostGISInterpreter.java
@@ -14,6 +14,8 @@ public class PostGISInterpreter extends ANSIInterpreter {
      */
     @Override
     public CharSequence visit(BBOX filter, Object extraData) {
+        if (filter.getExpression1() == null || filter.getExpression2() == null)
+            throw new UnsupportedOperationException("Not supported yet : bbox over all geometric
properties");
         return join(filter, "&&", extraData);
     }
 }


Mime
View raw message