treyfel commented on code in PR #699:
URL: https://github.com/apache/wayang/pull/699#discussion_r3138914544


##########
wayang-plugins/wayang-spatial/src/main/java/org/apache/wayang/spatial/operators/jdbc/JdbcSpatialFilterOperator.java:
##########
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.wayang.spatial.operators.jdbc;
+
+import org.apache.wayang.basic.operators.SpatialFilterOperator;
+import org.apache.wayang.core.api.spatial.SpatialGeometry;
+import org.apache.wayang.core.api.spatial.SpatialPredicate;
+import org.apache.wayang.core.function.FunctionDescriptor;
+import org.apache.wayang.core.types.DataSetType;
+import org.apache.wayang.spatial.function.JtsSpatialPredicate;
+import org.apache.wayang.jdbc.compiler.FunctionCompiler;
+import org.apache.wayang.jdbc.operators.JdbcExecutionOperator;
+
+import java.sql.Connection;
+
+
+/**
+ * Template for JDBC-based {@link SpatialFilterOperator}.
+ */
+public abstract class JdbcSpatialFilterOperator<Type> extends 
SpatialFilterOperator<Type> implements JdbcExecutionOperator {
+
+    /**
+     * Creates a new instance.
+     *
+     * @param relation the type of spatial filter (e.g., "INTERSECTS", 
"CONTAINS", "WITHIN")
+     */
+    public JdbcSpatialFilterOperator(SpatialPredicate relation,
+                                     
FunctionDescriptor.SerializableFunction<Type, ? extends SpatialGeometry> 
keyExtractor,
+                                     DataSetType<Type> inputClassDatasetType,
+                                     SpatialGeometry geometry) {
+        super(relation, keyExtractor, inputClassDatasetType, geometry);
+    }
+
+    public JdbcSpatialFilterOperator(SpatialFilterOperator<Type> that) {
+        super(that);
+    }
+
+    @Override
+    public String createSqlClause(Connection connection, FunctionCompiler 
compiler) {
+        if (this.referenceGeometry == null) {
+            throw new IllegalStateException("Geometry for spatial filter must 
not be null.");
+        }
+
+        // Column expression (e.g. "geom" or "t.geom")
+        final String columnExpr = 
this.keyDescriptor.getSqlImplementation().getField1();
+
+        // Geometry literal as ST_GeomFromText('WKT', srid)
+        final String wkt = this.referenceGeometry.toWKT();
+        // TODO: Check which SRID to use.
+        final int srid = 4326;

Review Comment:
   Afaik it’s the id of the coordinate reference system with the value we have 
assigned being the id of the earths coordinate reference system. I agree that 
this could be made clearer in the comment.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to